diff --git a/core/lib/src/data/temp_file.rs b/core/lib/src/data/temp_file.rs index d360a394..2ddbd503 100644 --- a/core/lib/src/data/temp_file.rs +++ b/core/lib/src/data/temp_file.rs @@ -38,19 +38,19 @@ use either::Either; /// /// # Configuration /// -/// * **temporary file directory** +/// `TempFile` is configured via the following [`config`](crate::config) +/// parameters: /// -/// Configured via the [`temp_dir`](crate::Config::temp_dir) configuration -/// parameter, defaulting to the system's default temporary -/// ([`std::env::temp_dir()`]). Specifies where the files are stored. +/// | Name | Default | Description | +/// |--------------------|---------------------|-----------------------------------------| +/// | `temp_dir` | [`env::temp_dir()`] | Directory files are temporarily stored. | +/// | `limits.file` | 1MiB | Default limit for all file extensions. | +/// | `limits.file/$ext` | _N/A_ | Limit for files with extension `$ext`. | /// -/// * **data limit** -/// -/// Controlled via [limits](crate::data::Limits) named `file` and `file/$ext`. -/// When used as a form guard, the extension `ext` is identified by the form -/// field's `Content-Type` ([`ContentType::extension()`]). When used as a data -/// guard, the extension is identified by the Content-Type of the request, if -/// any. If there is no Content-Type, the limit `file` is used. +/// When used as a form guard, the extension `$ext` is identified by the form +/// field's `Content-Type` ([`ContentType::extension()`]). When used as a data +/// guard, the extension is identified by the Content-Type of the request, if +/// any. If there is no Content-Type, the limit `file` is used. /// /// # Cappable /// diff --git a/core/lib/src/form/from_form_field.rs b/core/lib/src/form/from_form_field.rs index 6c5d29a0..09905a04 100644 --- a/core/lib/src/form/from_form_field.rs +++ b/core/lib/src/form/from_form_field.rs @@ -61,7 +61,8 @@ use crate::form::prelude::*; /// /// A value is validated successfully if the `from_str` method for the given /// type returns successfully. Only accepts form _values_, not binary data. -/// No data limit applies. +/// +/// **No type-specific data limit applies.** /// /// * **`bool`** /// @@ -70,7 +71,7 @@ use crate::form::prelude::*; /// `"off"`, `"no"`, or `"false"`. Defaults to `false` otherwise. Only /// accepts form _values_, not binary data. /// -/// **No data limit applies.** +/// **No type-specific data limit applies.** /// /// * **`&str`, `String`** /// @@ -81,14 +82,16 @@ use crate::form::prelude::*; /// /// * **[`TempFile`]** /// -/// Streams the form field value or data to a temporary file. See -/// [`TempFile`] for details and data limits. +/// Streams the form field value or data to a temporary file. +/// +/// **See [`TempFile`] for details and data limits.** /// /// * **[`Capped`], [`Capped`], [`Capped<&str>`]** /// /// Streams the form value or data to the inner value, succeeding even if -/// the data exceeds the respective type limit by truncating the data. See -/// [`Capped`] for details. +/// the data exceeds the respective type limit by truncating the data. +/// +/// **See [`Capped`] for details.** /// /// * **[`time::Date`]** /// @@ -96,7 +99,7 @@ use crate::form::prelude::*; /// This is the `"date"` HTML input type. Only accepts form _values_, not /// binary data. /// -/// **No data limit applies.** +/// **No type-specific data limit applies.** /// /// * **[`time::PrimitiveDateTime`]** /// @@ -105,7 +108,7 @@ use crate::form::prelude::*; /// without support for the millisecond variant. Only accepts form _values_, /// not binary data. /// -/// **No data limit applies.** +/// **No type-specific data limit applies.** /// /// * **[`time::Time`]** /// @@ -113,7 +116,7 @@ use crate::form::prelude::*; /// This is the `"time"` HTML input type without support for the millisecond /// variant. Only accepts form _values_, not binary data. /// -/// **No data limit applies.** +/// **No type-specific data limit applies.** /// /// [`TempFile`]: crate::data::TempFile /// diff --git a/examples/config/Rocket.toml b/examples/config/Rocket.toml index ba1f675a..f21bff8c 100644 --- a/examples/config/Rocket.toml +++ b/examples/config/Rocket.toml @@ -5,6 +5,7 @@ forms = "64 kB" json = "1 MiB" msgpack = "2 MiB" +"file/jpg" = "5 MiB" [debug] address = "127.0.0.1"