gh-130110: Support hyphens in RFC 2231 continuation parameter names#153536
gh-130110: Support hyphens in RFC 2231 continuation parameter names#153536Phantom-d-e-v wants to merge 2 commits into
Conversation
…ames Parameter names containing hyphens (e.g. `file-name*0*`) were not recognized as RFC 2231 continuations because the matching regular expression only allowed `\w+`. As a result, such parameters were left undecoded by `email.utils.decode_params`. Adjust the regular expression to also accept hyphens (`[\w-]+`), which matches the production behaviour for non-hyphenated names. Fixes: pythongh-130110
|
Most changes to Python require a NEWS entry. Add one using the blurb_it web app or the blurb command-line tool. If this change has little impact on Python users, wait for a maintainer to apply the |
|
|
||
|
|
||
| rfc2231_continuation = re.compile(r'^(?P<name>\w+)\*((?P<num>[0-9]+)\*?)?$', | ||
| rfc2231_continuation = re.compile(r'^(?P<name>[\w-]+)\*((?P<num>[0-9]+)\*?)?$', |
There was a problem hiding this comment.
If we're going to go to the trouble of fixing this, we should make it conform fully to the RFC. Are there any printable characters other than - that are not in specials and also not in \w? Hopefully there aren't any characters recognized by \w that shouldn't be valid in parameter names, because changing that would be backward incompatible.
|
A Python core developer has requested some changes be made to your pull request before we can consider merging it. If you could please address their requests along with any other requests in other reviews from core developers that would be appreciated. Once you have made the requested changes, please leave a comment on this pull request containing the phrase |
Parameter names containing hyphens (e.g.
file-name*0*) were not recognized as RFC 2231 continuations because the matching regular expression only allowed\w+. As a result, such parameters were left undecoded byemail.utils.decode_params.Adjust the regular expression to also accept hyphens (
[\w-]+), which matches the production behaviour for non-hyphenated names.Fixes: gh-130110