-
-
Notifications
You must be signed in to change notification settings - Fork 16.3k
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
Flask.send_file incorrectly sends blank files #3358
Comments
Sorry the spam, I didn't see the PR was from another project... |
Ok, now entering in the subject, I understand the suggested behavior is not retrocompatible, right? |
The fact that we support |
Determining if a given file-like object reads bytes appears to be non-trivial, especially with compatibility with Python 2's |
Flask.send_file
sends blank files when usingio.StringIO
in Python 3. There is a warning that this is wrong but the response code is still 200 but with a blank file.Testing this behavior with a test_client will however still result in output. Which doesn't really make sense.
Related Info:
https://stackoverflow.com/questions/35710361/python-flask-send-file-stringio-blank-files
Expected Behavior
Flask.send_file
should accept anio.StringIO
file object and send it to the browser properlyFlask.send_file
should 500 on the the request instead of a blank fileapp.test_client
shouldn't have data in this setupTest Case:
Run in Python 3
Actual Behavior
Environment
The text was updated successfully, but these errors were encountered: