Skip to content

gh-135854: Fix function email.message.Message.get_boundary strips boundaries twice - #135891

Open
tanloong wants to merge 7 commits into
python:mainfrom
tanloong:fix-duplicate-boundary-stripping
Open

gh-135854: Fix function email.message.Message.get_boundary strips boundaries twice#135891
tanloong wants to merge 7 commits into
python:mainfrom
tanloong:fix-duplicate-boundary-stripping

Conversation

@tanloong

@tanloong tanloong commented Jun 24, 2025

Copy link
Copy Markdown
Contributor

email.message.get_boundary() invokes email.message.get_param() and utils.collapse_rfc2231_value(), causing boundaries being stripped twice. This PR passes unquote=False to email.message.get_param() to avoid the redundant stripping.

Comment thread Lib/test/test_email/test_email.py Outdated
Comment thread Lib/test/test_email/test_email.py Outdated
@tanloong

tanloong commented Aug 9, 2025

Copy link
Copy Markdown
Contributor Author

Hi all, it's been a month and a half since this PR is created. Could some core dev give this PR a review? Thanks.

@github-actions

Copy link
Copy Markdown

This PR is stale because it has been open for 30 days with no activity.

@github-actions github-actions Bot added the stale Stale PR or inactive for long period of time. label Apr 26, 2026
@github-actions github-actions Bot removed the stale Stale PR or inactive for long period of time. label May 15, 2026
@github-actions

Copy link
Copy Markdown

This PR is stale because it has been open for 90 days with no activity.

@github-actions github-actions Bot added the stale Stale PR or inactive for long period of time. label Aug 17, 2026

msg = email.message_from_string(textwrap.dedent('''\
MIME-Version: 1.0
Content-Type: multipart/mixed; boundary=<"">

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Unfortunately, this is not a valid parameter value. Technically this should in fact fail to be recognized as a multipart. Per rfc 2045, <> characters must be inside quotes to be valid. Any idea what other email programs do with this kind of broken value?

I'm reluctant to apply the proposed fix since it would make valid a boundary specification that is not in fact valid. See my comments on the issue for more.

@bedevere-app

bedevere-app Bot commented Aug 19, 2026

Copy link
Copy Markdown

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.

@github-actions github-actions Bot removed the stale Stale PR or inactive for long period of time. label Aug 23, 2026
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.

4 participants