-
-
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
Do not cause errors for unknown files for sendfile #2019
Conversation
@untitaker can you have a look at this one? |
This is actually intentional behavior as per #1988. The idea was that Is this the behavior you can agree with? In any case if you want to change your decision (you approved the mentioned PR), it needs a doc update in |
Oh, I also remember that I made this behavior more explicit because when we stopped using |
@untitaker we can't force people to add all mimetypes unfortunately. I think the behavior of this pull request is what I like to have. I will update the docs accordingly. |
We can add a new parameter alternatively that controls the fallback. |
In any case the current regression is really bad for a lot of of useful cases where we just don't have a mimetype and also inconsistent with what other frameworks in Python do. |
As said I think silently falling back to octet-stream by default will also introduce regressions in a much more silent way. Nobody said anything about all mimetypes, but adding the ones the application uses is doable for the developer imo. But I don't have a strong opinion on this. On 11 September 2016 10:29:47 CEST, Armin Ronacher notifications@github.com wrote:
Sent from my Android device with K-9 Mail. Please excuse my brevity. |
@untitaker what is the actual regression if something serves up as octet stream? Most browsers ignore the mimetype anyways for resource loading. |
Serving with an incorrect mimetype is still technically wrong, and that there are only a handful of browsers that break on incorrect mimetypes doesn't make it easier to debug either. Also you don't even have to use On 11 September 2016 11:00:43 CEST, Armin Ronacher notifications@github.com wrote:
Sent from my Android device with K-9 Mail. Please excuse my brevity. |
@untitaker i don't want to reintroduce the handling of |
Would it make sense to only raise an error if a file-like object is passed and On Sun, Sep 11, 2016 at 02:15:30AM -0700, Armin Ronacher wrote:
|
@untitaker that is basically what the current code is doing. (And no attachment filename that is. That seems like a sensible behavior to me but i can restrict it to fail for streams specifically) |
I mean:
(and without attachment_filename or explicit mimetype) On Sun, Sep 11, 2016 at 02:26:12AM -0700, Armin Ronacher wrote:
|
👍 for this PR, had a brainfart about possible silent regression when using What needs an update is |
LGTM though I think the docstring of |
Unknown files must not raise errors when send with send-file if the
sending happens by filename. This is particularly important for
send from directory which can send up loads of unknown files.
This regressed at one point in the last two weeks. It came up
with woff2 files sent from static folders which are unknown in
the default mimetype database.
This change is