-
-
Notifications
You must be signed in to change notification settings - Fork 16.2k
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
Bug in send_file with temp files #1427
Comments
The whole feature is apparently supposed to be deprecated, so I don't think a fix is worth it. You're supposed to use I want to keep this open as a reminder for deprecation though. |
Thing is, with this function in its current version, even if you pass an If the whole function is refactored in the next version I agree that it's not worth fixing it, but if it has to stay for longer... |
Yeah I'd say we just refactor the whole thing in 1.0. |
Another bug with tempfile.SpooledTemporaryFile when object become a fd (when it exceeds the given size)
|
Was the temporary file created with |
Spooled has no option delete (https://docs.python.org/2/library/tempfile.html) |
I'm looking at this issue at PyCon. Should the deprecation warnings be removed, and the file object functionality stay otherwise? |
+1 for removing name guessing. being able to send a file object needs to stay (but w/o name guessing) |
@ThiefMaster What should the behavior be when a file object is passed, but |
Pull Request #1849 |
This can be closed now, the PR above has been merged. |
Done, thanks guys 👍 |
Hey there,
I don't know if anyone ran into this problem before because it works "by chance" in py2, but in py3 you can't send temporary file with
send_file
by passing a fp.The main problems are here https://github.com/mitsuhiko/flask/blob/master/flask/helpers.py#L477 and there https://github.com/mitsuhiko/flask/blob/master/flask/helpers.py#L496.
Under py2 a
tempfile.TemporaryFile
is given the name'<fdopen>'
whereas under py3 it's an integer.Then when Flask tries to build
filename
it crashes (trying to concatenate a string and an integer inos.path.join(current_app.root_path, filename)
).Would you consider merging a workaround for this problem? (like setting
filename
toNone
if we don't have astring_types
for instance)The text was updated successfully, but these errors were encountered: