summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSanto Cariotti <santo@dcariotti.me>2022-09-10 15:57:07 +0000
committerSanto Cariotti <santo@dcariotti.me>2022-09-10 15:57:07 +0000
commit05dcdfd5f148f43887fc4cda78c0111ed8d7a7a0 (patch)
treea1974b3c20b6aec388078d988bedc9de9bc91fb9
parent89b2507495dec2835de4b28ade8c05ac4534f937 (diff)
Raise error if file is not uploaded
-rw-r--r--src/files.rs8
1 files changed, 7 insertions, 1 deletions
diff --git a/src/files.rs b/src/files.rs
index 63b8eec..fe7265a 100644
--- a/src/files.rs
+++ b/src/files.rs
@@ -40,5 +40,11 @@ pub async fn upload(
}
}
- Ok(save_filename)
+ if save_filename != "" {
+ return Ok(save_filename);
+ }
+
+ Err(AppError::BadRequest(
+ "File extension not supported".to_string(),
+ ))
}