Adjust handling of (unquoted) extended parameters in headers#2536
Adjust handling of (unquoted) extended parameters in headers#2536runderwood wants to merge 4 commits intopallets:mainfrom runderwood:main
Conversation
…age identifiers) to conform with standards and browser implementations
…ters in dump_header
| """ | ||
| if utf8: | ||
| assert f"filename*=UTF-8''{utf8}" in content_disposition | ||
| else: |
There was a problem hiding this comment.
I'm not sure why this condition has been removed
There was a problem hiding this comment.
I think I thought it was moot at the time, but you're absolutely right - - I'll put it back.
| content_disposition = rv.headers["Content-Disposition"] | ||
| assert f"filename={ascii}" in content_disposition | ||
|
|
||
| """Per RFC 5987/8187, "extended" values may *not* be quoted. |
There was a problem hiding this comment.
I think this would be better as a comment #, although I don't think it is appropriate here.
There was a problem hiding this comment.
Would you prefer I remove the comment altogether or reformat it with single-line comment(s)? It was largely a reminder to myself about which standards docs provided the basis for the changes. If it doesn't seem helpful, I'm happy to pull it out entirely.
There was a problem hiding this comment.
Could you pull it out entirely. The comment is in the commit and the docstring above where it is more relevant in my view.
|
This makes sense to me, bar a couple of questions |
|
Thanks, I've merged this manually into the 2.2.x branch (as to me this is a bug fix). See 97547cc |
Adjust handling of (unquoted) extended parameters in headers to conform with RFCs and browser implementations.
Addresses #2529 by matching these implementations, namely not quoting extended parameter values with charset/language syntax (see RFC 8187/5987 -- also Chromium's handling of extended parameter values).
Also moves mypy comment (
type: ignore) so as to no longer be unused.Checklist:
CHANGES.rstsummarizing the change and linking to the issue... versionchanged::entries in any relevant code docs.pre-commithooks and fix any issues.pytestandtox, no tests failed.