summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorSanto Cariotti <santo@dcariotti.me>2022-09-13 14:01:16 +0000
committerSanto Cariotti <santo@dcariotti.me>2022-09-13 14:01:16 +0000
commitd7ad64ab7b779886af75d2500365372921c9181e (patch)
tree432ea78b629b54b21eb1574191ffc23490981d52 /src
parent2b2b2e103028a3c3e2a0f129e5c903aa18087ebd (diff)
Fix: url for delete_upload
Url passed at `delete_upload` could be different into the filesystem, so replace the first part of the url with the environment var
Diffstat (limited to 'src')
-rw-r--r--src/files.rs9
1 files changed, 8 insertions, 1 deletions
diff --git a/src/files.rs b/src/files.rs
index 7addda2..f72070b 100644
--- a/src/files.rs
+++ b/src/files.rs
@@ -57,7 +57,14 @@ pub async fn upload(
/// Delete a file from the filesystem
pub fn delete_upload(filename: &String) -> Result<(), AppError> {
- fs::remove_file(filename)?;
+ let last_slash_index = filename.rfind('/').unwrap();
+ let path = format!(
+ "{}/{}",
+ CONFIG.save_file_base_path,
+ &filename[last_slash_index + 1..]
+ );
+
+ fs::remove_file(path)?;
Ok(())
}