]> git.ipfire.org Git - thirdparty/Python/cpython.git/commit
[3.13] gh-144156: Fix email header folding concatenating encoded words (GH-144692...
authorR. David Murray <rdmurray@bitdance.com>
Tue, 24 Feb 2026 20:55:54 +0000 (15:55 -0500)
committerGitHub <noreply@github.com>
Tue, 24 Feb 2026 20:55:54 +0000 (15:55 -0500)
commita3c0a809e1d2a43125cbd8d03d34a6591242d304
treebc061e1bd3f1ef09cd3915267fb4f8453771d591
parent6f1e0c4f01a6f3605d3ec9afa2d38bd65cdb0eb9
[3.13] gh-144156: Fix email header folding concatenating encoded words (GH-144692) (#145195)

The fix for gh-92081 (gh-92281) was unfortunately flawed, and broke whitespace handling for encoded word patterns that had previously been working correctly but had no corresponding tests, unfortunately in a way that made the resulting headers not RFC compliant, in such a way that Yahoo started rejecting the resulting emails.  This fix was released in 3.14 alpha 1, 3.13 beta 2 and 3.12.5.   This PR fixes the original problem in a way that does not break anything, and in fact fixes a small pre-existing bug (a spurious whitespace after the ':' of the header label if the header value is immediately wrapped on to the next line).  (RDM)
(cherry picked from commit 0f7cd5544a4dd1d7cf892c93c661510d619caaa7)

Co-authored-by: Robsdedude <dev@rouvenbauer.de>
Co-authored-by: blurb-it[bot] <43283697+blurb-it[bot]@users.noreply.github.com>
Lib/email/_header_value_parser.py
Lib/test/test_email/test_generator.py
Lib/test/test_email/test_headerregistry.py
Lib/test/test_email/test_policy.py
Misc/NEWS.d/next/Library/2026-02-10-22-05-51.gh-issue-144156.UbrC7F.rst [new file with mode: 0644]