Skip to content

Commit

Permalink
refactor: rename config variable
Browse files Browse the repository at this point in the history
  • Loading branch information
Narayanbhat166 committed Aug 18, 2024
1 parent d229895 commit 2328473
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 3 deletions.
2 changes: 1 addition & 1 deletion fixtures/test-server-upload-dir-limit/config.toml
Original file line number Diff line number Diff line change
@@ -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]
Expand Down
2 changes: 1 addition & 1 deletion src/config.rs
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ pub struct ServerConfig {
/// Storage path.
pub upload_path: PathBuf,
/// Maximum upload directory size.
pub max_upload_dir_size: Option<Byte>,
pub max_uploads: Option<Byte>,
/// Request timeout.
#[serde(default, with = "humantime_serde")]
pub timeout: Option<Duration>,
Expand Down
2 changes: 1 addition & 1 deletion src/paste.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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)?;
Expand Down

0 comments on commit 2328473

Please sign in to comment.