Skip to content

gh-144156: Fix email header folding concatenating encoded words#144692

Open
robsdedude wants to merge 13 commits intopython:mainfrom
robsdedude:fix/gh-144156
Open

gh-144156: Fix email header folding concatenating encoded words#144692
robsdedude wants to merge 13 commits intopython:mainfrom
robsdedude:fix/gh-144156

Conversation

@robsdedude
Copy link
Contributor

@robsdedude robsdedude commented Feb 10, 2026

@bedevere-app
Copy link

bedevere-app bot commented Feb 10, 2026

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 skip news label instead.

@robsdedude robsdedude changed the title gh-144156: Fix email header wrapping omitting white space gh-144156: Fix email header folding concatenating encoded words Feb 10, 2026
@robsdedude robsdedude marked this pull request as ready for review February 11, 2026 13:32
@robsdedude robsdedude requested a review from a team as a code owner February 11, 2026 13:32
@bitdancer
Copy link
Member

FYI I've been looking at this and will have a review soonish. You are correct that the gh-92281 fix was buggy.

Copy link
Member

@bitdancer bitdancer left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for fixing this!

I edited this review a bunch, so mistake could have crept in to my code suggestions, though I did test them. The randomizer test should catch any transcription errors if nothing else does.

@@ -0,0 +1,3 @@
Fix folding of email headers violating `RFC 2047`_ with two consecutive encoded words without separating linear-white-space.

.. _RFC 2047: https://www.rfc-editor.org/rfc/rfc2047
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
.. _RFC 2047: https://www.rfc-editor.org/rfc/rfc2047
Fix the folding of headers by the :mod:`email` library when :rfc:`2047` encoded words are used. Now whitespace is correctly preserved and also correctly added between adjacent encoded words. The latter property was broken by the fix for gh-92081, which mostly fixed previous failures to preserve whitespace.

Out of curiosity I checked, and according to the changelogs the buggy fix was released in 3.14 alpha 1, 3.13 beta 2 and 3.12.5. Unfortunately the latter is now final. Maybe we should include that in the news item? I'm not sure what the policy is on that.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe we should include that in the news item?

I'm all for documenting known issues and shortcomings. However, I doubt people would find this info in the release notes unless they're doing "software archeology", i.e., they already know (roughly) what info they're looking for.

I'm not sure what the policy is on that.

Neither am I. I'm pretty much a first-time contributor 😅

@bedevere-app
Copy link

bedevere-app bot commented Feb 12, 2026

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 I have made the requested changes; please review again. I will then notify any core developers who have left a review that you're ready for them to take another look at this pull request.

Make use of the fact that folder must never produce a line of only WSP.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants