diff --git a/fixtures/test-server-upload-dir-limit/config.toml b/fixtures/test-server-upload-dir-limit/config.toml index 53bd752..2757a0b 100644 --- a/fixtures/test-server-upload-dir-limit/config.toml +++ b/fixtures/test-server-upload-dir-limit/config.toml @@ -1,7 +1,7 @@ [server] address = "127.0.0.1:8000" max_content_length = "10KB" -max_upload_dir_size = "20KB" +max_uploads = "20KB" upload_path = "./upload" [paste] diff --git a/src/config.rs b/src/config.rs index a995f80..d3af418 100644 --- a/src/config.rs +++ b/src/config.rs @@ -44,7 +44,7 @@ pub struct ServerConfig { /// Storage path. pub upload_path: PathBuf, /// Maximum upload directory size. - pub max_upload_dir_size: Option, + pub max_uploads: Option, /// Request timeout. #[serde(default, with = "humantime_serde")] pub timeout: Option, diff --git a/src/paste.rs b/src/paste.rs index 11b3eb1..6a79f13 100644 --- a/src/paste.rs +++ b/src/paste.rs @@ -113,7 +113,7 @@ impl Paste { } } - if let Some(max_dir_size) = config.server.max_upload_dir_size { + if let Some(max_dir_size) = config.server.max_uploads { // The unwrap here should be fine as the max value of u64 will be within the limits let file_size = u64::try_from(self.data.len()).unwrap_or_default(); let upload_dir = self.type_.get_path(&config.server.upload_path)?;