1
0
Fork 0
mirror of https://github.com/actix/actix-web.git synced 2024-06-13 10:49:26 +00:00

Update named.rs

This commit is contained in:
Dialga 2024-01-07 22:51:43 +13:00 committed by GitHub
parent 46dde69d50
commit 15bfcebf18
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -139,8 +139,12 @@ impl NamedFile {
_ => DispositionType::Attachment,
};
// Replace newlines in filenames which could occur on some filesystems.
let filename_s = filename.replace('\n', "%0A");
// Replace newlines and other line breaks in filenames which could occur on some filesystems.
let filename_s = filename
.replace('\n', "%0A")
.replace('\x0B', "%0B") // \v vertical tab
.replace('\x0C', "%0C") // \f form feed
.replace('\r', "%0D");
let mut parameters = vec![DispositionParam::Filename(filename_s)];
if !filename.is_ascii() {