Skip to content
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: allow explicit etag passing #1868

Closed
ThiefMaster opened this issue Jun 29, 2020 · 5 comments · Fixed by #2007
Closed

send_file: allow explicit etag passing #1868

ThiefMaster opened this issue Jun 29, 2020 · 5 comments · Fixed by #2007
Milestone

Comments

@ThiefMaster
Copy link
Member

send_file should have a kwarg for explicitly specifying an etag so it can be used even without a physical file where it would be autogenerated.

Right now one has to copy&paste code (the stuff from if conditional:) into their if they want to include an etag for a file that does not represent a physical file on disk, because make_conditional should ideally be used on a response that already has an etag set...

This depends on #1850 since it moves send_file from Flask to werkzeug.

@davidism
Copy link
Member

Would allowing add_etags to be a string or list of strings in addition to True be a good idea?

@davidism davidism added this to the 2.0.0 milestone Jul 13, 2020
@davidism
Copy link
Member

@ThiefMaster let me know if that's what you had in mind, or something else.

@ThiefMaster
Copy link
Member Author

Not sure if mixing bool and string is that clean but it certainly sounds like a solution that would work.

@kx-chen

This comment has been minimized.

@davidism
Copy link
Member

davidism commented Jan 17, 2021

I couldn't find any reference for allowing multiple ETag header values in the response, so I'm only implementing str, not list. Taking advantage of the fact that we're renaming other parameters during the move, I renamed the parameter to etag, since the previous name seemed incorrect on a few levels. I added a corresponding rename and warning to Flask (to go with the other two so far), although since this defaults to True it's unlikely to come up much.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Feb 1, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants