Only keep filename for cli filename hint

master
Edward Shen 2022-01-16 19:40:57 -08:00
parent f1ad421777
commit d6b2d53249
Signed by: edward
GPG Key ID: 19182661E818369F
1 changed files with 6 additions and 2 deletions

View File

@ -151,8 +151,12 @@ fn handle_upload(
}
if !no_file_name_hint {
if let Some(path) = path {
fragment = fragment.file_name(path.to_string_lossy().to_string());
let file_name = path.and_then(|path| {
path.file_name()
.map(|str| str.to_string_lossy().to_string())
});
if let Some(file_name) = file_name {
fragment = fragment.file_name(file_name);
}
}