Skip to content

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

Open
lpyu001 wants to merge 1 commit into
python:mainfrom
lpyu001:fix-email-unquoted-apostrophe
Open

gh-153823: Parse apostrophes in unquoted MIME parameter values#153846
lpyu001 wants to merge 1 commit 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
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