]> git.ipfire.org Git - thirdparty/Python/cpython.git/commit
bpo-39040: Fix parsing of email mime headers with whitespace between encoded-words...
authorMiss Islington (bot) <31488909+miss-islington@users.noreply.github.com>
Fri, 29 May 2020 11:43:47 +0000 (04:43 -0700)
committerGitHub <noreply@github.com>
Fri, 29 May 2020 11:43:47 +0000 (04:43 -0700)
commit5f977e09e8a29dbd5972ad79c4fd17a394d1857f
tree7960f84ef3ed8a2e873e6fadf363dffbe5716bc1
parentf5bd99b84f89cc4cf50a3abd8be801b366fc9147
bpo-39040: Fix parsing of email mime headers with whitespace between encoded-words. (gh-17620)

* bpo-39040: Fix parsing of email headers with encoded-words inside a quoted string.

It is fairly common to find malformed mime headers (especially content-disposition
headers) where the parameter values, instead of being encoded to RFC
standards, are "encoded" by doing RFC 2047 "encoded word" encoding, and
then enclosing the whole thing in quotes.  The processing of these malformed
headers was incorrectly leaving the spaces between encoded words in the decoded
text (whitespace between adjacent encoded words is supposed to be stripped on
decoding).  This changeset fixes the encoded word processing inside quoted strings
(bare-quoted-string) to do correct RFC 2047 decoding by stripping that
whitespace.
(cherry picked from commit 21017ed904f734be9f195ae1274eb81426a9e776)

Co-authored-by: Abhilash Raj <maxking@users.noreply.github.com>
Lib/email/_header_value_parser.py
Lib/test/test_email/test_headerregistry.py
Misc/NEWS.d/next/Library/2019-12-15-18-47-20.bpo-39040.tKa0Qs.rst [new file with mode: 0644]