rocket_multipart_form_data/fields.rs
1use std::path::PathBuf;
2
3use crate::mime::Mime;
4
5/// A field stored as a file.
6#[derive(Debug)]
7pub struct FileField {
8 /// The content type sent by the client, if any.
9 pub content_type: Option<Mime>,
10 /// The file name sent by the client, if any.
11 ///
12 /// It is not sanitized at all. Never use it as a path or a part of a path, or the client may be able to escape the intended directory.
13 pub file_name: Option<String>,
14 /// The path of the temporary file which stores the data of this field.
15 pub path: PathBuf,
16}
17
18/// A field stored as a `Vec<u8>` instance.
19#[derive(Debug)]
20pub struct RawField {
21 /// The content type sent by the client, if any.
22 pub content_type: Option<Mime>,
23 /// The file name sent by the client, if any.
24 ///
25 /// It is not sanitized at all. Never use it as a path or a part of a path, or the client may be able to escape the intended directory.
26 pub file_name: Option<String>,
27 /// The data of this field.
28 pub raw: Vec<u8>,
29}
30
31/// A field stored as a string.
32#[derive(Debug)]
33pub struct TextField {
34 /// The content type sent by the client, if any.
35 pub content_type: Option<Mime>,
36 /// The file name sent by the client, if any.
37 ///
38 /// It is not sanitized at all. Never use it as a path or a part of a path, or the client may be able to escape the intended directory.
39 pub file_name: Option<String>,
40 /// The data of this field.
41 pub text: String,
42}