mirror of
https://github.com/actix/examples
synced 2025-06-28 18:00:37 +02:00
Sanitize filename
This commit is contained in:
@ -17,3 +17,4 @@ bytes = { version = "0.5", features = ["serde"] }
|
||||
serde = { version = "1.0.104", features = ["derive"] }
|
||||
serde_json = "1.0"
|
||||
dotenv = "0.15.0"
|
||||
sanitize-filename = "0.2"
|
||||
|
@ -78,7 +78,7 @@ pub async fn split_payload(payload: &mut Multipart) -> (bytes::Bytes, Vec<Tmpfil
|
||||
} else {
|
||||
match content_type.get_filename() {
|
||||
Some(filename) => {
|
||||
let tmp_file = Tmpfile::new(filename);
|
||||
let tmp_file = Tmpfile::new(&sanitize_filename::sanitize(&filename));
|
||||
let tmp_path = tmp_file.tmp_path.clone();
|
||||
let mut f = web::block(move || std::fs::File::create(&tmp_path))
|
||||
.await
|
||||
|
Reference in New Issue
Block a user