New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
send_file not inserting quote around filename #2827
Comments
The problem comes from these lines in Lines 165 to 169 in d3dd65a
This is used called from dump_options_header .
Do you know if this is true for all headers? If yes, it may be safer to default to |
Honestly I don't know, manually adding the quotes using a regex fixed the problem, but I imagine it is not the correct solution, it's just a workaround. |
I can't reproduce this issue. Sending a filename without spaces is downloaded with the correct filename by Firefox, Vivaldi (Chrome), and Safari. The |
The problem can be reproduced if you set your language to italian and you try firefox to download any file like "test.pdf" |
Overview
The function send_file does not insert quotes around the filename in the
Content-Disposition
header when the sent file does not have spaces. (See here for MDN docs)This causes browser (tested on Windows 11 - last version to date of Firefox and Chrome) to download the file with a blank name (respectively as
undefined
andundefined.txt
)To recap:
test.pdf
is sent with send_file the followingContent-Disposition
header is set to:attachment; filename=test.pdf
-> Correct file is sent but with wrong filenametest 1.pdf
is sent with send_file the followingContent-Disposition
header is set to:attachment; filename="test 1.pdf"
-> Works perfectlyBug replication
Send a file without spaces in name:
Expected behavior:
test.pdf
is sent with send_file the followingContent-Disposition
header is set to:attachment; filename="test.pdf"
test 1.pdf
is sent with send_file the followingContent-Disposition
header is set to:attachment; filename="test 1.pdf"
Environment:
The text was updated successfully, but these errors were encountered: