diff options
Diffstat (limited to 'src/file_upload.rs')
-rw-r--r-- | src/file_upload.rs | 15 |
1 files changed, 6 insertions, 9 deletions
diff --git a/src/file_upload.rs b/src/file_upload.rs index 5009f36..0d4b8a5 100644 --- a/src/file_upload.rs +++ b/src/file_upload.rs @@ -43,15 +43,12 @@ async fn handle_multipart( path: PathBuf, overwrite_files: bool, ) -> Result<u64, ContextualError> { - let filename = field - .content_disposition() - .and_then(|cd| cd.get_filename().map(String::from)) - .ok_or_else(|| { - ContextualError::ParseError( - "HTTP header".to_string(), - "Failed to retrieve the name of the file to upload".to_string(), - ) - })?; + let filename = field.content_disposition().get_filename().ok_or_else(|| { + ContextualError::ParseError( + "HTTP header".to_string(), + "Failed to retrieve the name of the file to upload".to_string(), + ) + })?; let filename = sanitize_path(Path::new(&filename), false).ok_or_else(|| { ContextualError::InvalidPathError("Invalid file name to upload".to_string()) |