Skip to content

gh-153823: Parse apostrophes in unquoted MIME parameter values - #153846

Open
lpyu001 wants to merge 2 commits into
python:mainfrom
lpyu001:fix-email-unquoted-apostrophe
Open

lpyu001 wants to merge 2 commits into
python:mainfrom
lpyu001:fix-email-unquoted-apostrophe

Conversation

@lpyu001

@lpyu001 lpyu001 commented Jul 17, 2026

Copy link
Copy Markdown
Contributor

Summary

Fixes gh-153823.

email.policy.default incorrectly treated apostrophes as delimiters in all unquoted MIME parameter values. Apostrophes are not MIME tspecials, so values such as filename=O'Brien.pdf and multipart boundaries containing apostrophes are valid tokens.

This change:

  • parses regular unquoted parameter values using MIME token syntax;
  • preserves existing RFC 2231 extended-value handling and error recovery;
  • adds regression tests for filenames, multipart boundaries, and header registry parsing.

Use MIME token syntax for regular parameter values while preserving RFC 2231
@lpyu001 lpyu001 closed this Sep 23, 2026
@lpyu001
lpyu001 deleted the fix-email-unquoted-apostrophe branch September 23, 2026 02:54
@lpyu001
lpyu001 restored the fix-email-unquoted-apostrophe branch September 23, 2026 03:07
@lpyu001 lpyu001 reopened this Sep 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.

email: unquoted apostrophe in a MIME parameter value is dropped under policy.default

1 participant