1
0
mirror of https://github.com/actix/examples synced 2025-06-29 02:10:36 +02:00

Sanitize filename

This commit is contained in:
Yuki Okushi
2020-05-19 13:48:49 +09:00
parent bc6f614f78
commit 7823473f8d
6 changed files with 6 additions and 3 deletions

View File

@ -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