]> git.ipfire.org Git - thirdparty/Python/cpython.git/commit
gh-144156: Fix email header folding concatenating encoded words (#144692)
authorRobsdedude <dev@rouvenbauer.de>
Thu, 19 Feb 2026 18:29:05 +0000 (19:29 +0100)
committerGitHub <noreply@github.com>
Thu, 19 Feb 2026 18:29:05 +0000 (13:29 -0500)
commit0f7cd5544a4dd1d7cf892c93c661510d619caaa7
treea53e7a4b880354d5118766b308f817850bbc6e38
parent6485c8583a112c343525a14cf519275267b95185
gh-144156: Fix email header folding concatenating encoded words (#144692)

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)

Co-authored-by: blurb-it[bot] <43283697+blurb-it[bot]@users.noreply.github.com>
Co-authored-by: R. David Murray <rdmurray@bitdance.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/Core_and_Builtins/2026-02-10-22-05-51.gh-issue-144156.UbrC7F.rst [new file with mode: 0644]