Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

Already on GitHub? Sign in to your account

fix a etags bug when sending a file stream with a name #930

Closed
wants to merge 2 commits into
from

Conversation

Projects
None yet
3 participants

When sending a file stream with a name, but the file doesn't exist,
when adding etags, an exception will raise. OSError: [Errno 2] No such file or directory:

fix a etags bug when sending a file stream with a name
When sending a file stream with a name, but the file doesn't exist,
when adding etags, an exception will raise.
Contributor

DasIch commented Dec 14, 2013

This is not a solution to the problem because the file can be removed between the os.path.exists() check and being accessed. Use try..except to catch the exception instead.

use try...cache to solve the file does not exist problem
when adding etags, the file can be remove or does not exists, so
use try...except to cache the exception, and ignore the etags.

@DasIch thanks, I have changed to use try...cache, and I undo the check os.path.exists(filename) in if current_app.use_x_sendfile and filename: in my last commit , I think if the people want to use X-sendfile, he should make sure the file exists.

Owner

mitsuhiko commented Feb 8, 2014

Applied. Thanks.

@mitsuhiko mitsuhiko closed this Feb 8, 2014

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment