aboutsummaryrefslogtreecommitdiffstats
path: root/src/file_upload.rs
diff options
context:
space:
mode:
authorSven-Hendrik Haase <svenstaro@gmail.com>2021-03-28 20:41:07 +0000
committerSven-Hendrik Haase <svenstaro@gmail.com>2021-03-28 20:41:07 +0000
commit906af1587144dd4b3caecacdff5ea834012cffa4 (patch)
tree57ca5b252dcfc76fa79b7a0f41584527b4188cff /src/file_upload.rs
parentChange start message without arguments to be a bit more clear (diff)
downloadminiserve-906af1587144dd4b3caecacdff5ea834012cffa4.tar.gz
miniserve-906af1587144dd4b3caecacdff5ea834012cffa4.zip
Refuse to start without explicit path if not attached to interactive terminal
Diffstat (limited to 'src/file_upload.rs')
-rw-r--r--src/file_upload.rs4
1 files changed, 1 insertions, 3 deletions
diff --git a/src/file_upload.rs b/src/file_upload.rs
index 785d72f..93b7109 100644
--- a/src/file_upload.rs
+++ b/src/file_upload.rs
@@ -20,9 +20,7 @@ fn save_file(
overwrite_files: bool,
) -> Pin<Box<dyn Future<Output = Result<i64, ContextualError>>>> {
if !overwrite_files && file_path.exists() {
- return Box::pin(future::err(ContextualError::CustomError(
- "File already exists, and the overwrite_files option has not been set".to_string(),
- )));
+ return Box::pin(future::err(ContextualError::DuplicateFileError));
}
let mut file = match std::fs::File::create(&file_path) {