Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

gh-106186: Don't report MultipartInvariantViolationDefect for valid multipart emails when parsing header only#107016

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to ourterms of service andprivacy statement. We’ll occasionally send you account related emails.

Already on GitHub?Sign in to your account

Merged
ambv merged 5 commits intopython:mainfromhtsedebenham:gh-106186
Jul 23, 2023

Conversation

@htsedebenham
Copy link
Contributor

@htsedebenhamhtsedebenham commentedJul 22, 2023
edited by bedevere-bot
Loading

The following code used to report a MultipartInvariantViolationDefect. However, the message body is not parsed whenheadersonly=True, so the parsing required foris_multipart() to work is not carried out. Add this as a case to ignore when validating the message body inclose()

import email.parserimport email.policyemail_str = '''\Date: 01 Jan 2001 00:01+0000From: arthur@example.exampleMIME-Version: 1.0Content-Type: multipart/mixed; boundary=autocracy--autocracyContent-Type: text/plainBy hanging on to outdated imperialist dogma which perpetuates the economic andsocial differences in our society.--autocracyContent-Type: text/html<html><body><p>By hanging on to outdated imperialist dogma which perpetuatesthe economic and social differences in our society.</p></body></html>--autocracy--'''full_parser = email.parser.Parser(policy=email.policy.default)parsed_email_full = full_parser.parsestr(email_str)print(parsed_email_full.defects)  # Prints [] as expectedheader_parser = email.parser.HeaderParser(policy=email.policy.default)parsed_email_headers_only = header_parser.parsestr(email_str)print(parsed_email_headers_only.defects)  # Used to print [MultipartInvariantViolationDefect()].  Now prints []

@bedevere-bot
Copy link

Most changes to Pythonrequire a NEWS entry.

Please add it using theblurb_it web app or theblurb command-line tool.

@ghost
Copy link

ghost commentedJul 22, 2023
edited by ghost
Loading

All commit authors signed the Contributor License Agreement.
CLA signed

@bedevere-bot
Copy link

Most changes to Pythonrequire a NEWS entry.

Please add it using theblurb_it web app or theblurb command-line tool.

@ambvambv added needs backport to 3.11only security fixes needs backport to 3.12only security fixes labelsJul 23, 2023
@ambvambv merged commitc65592c intopython:mainJul 23, 2023
@miss-islington
Copy link
Contributor

Thanks@htsedebenham for the PR, and@ambv for merging it 🌮🎉.. I'm working now to backport this PR to: 3.11, 3.12.
🐍🍒⛏🤖

@bedevere-bot
Copy link

GH-107111 is a backport of this pull request to the3.12 branch.

miss-islington pushed a commit to miss-islington/cpython that referenced this pull requestJul 23, 2023
…alid multipart emails when parsing header only (pythonGH-107016)(cherry picked from commitc65592c)Co-authored-by: htsedebenham <31847376+htsedebenham@users.noreply.github.com>
@bedevere-botbedevere-bot removed the needs backport to 3.12only security fixes labelJul 23, 2023
@bedevere-bot
Copy link

GH-107112 is a backport of this pull request to the3.11 branch.

miss-islington pushed a commit to miss-islington/cpython that referenced this pull requestJul 23, 2023
…alid multipart emails when parsing header only (pythonGH-107016)(cherry picked from commitc65592c)Co-authored-by: htsedebenham <31847376+htsedebenham@users.noreply.github.com>
@bedevere-botbedevere-bot removed the needs backport to 3.11only security fixes labelJul 23, 2023
ambv pushed a commit that referenced this pull requestJul 23, 2023
…valid multipart emails when parsing header only (GH-107016) (#107111)(cherry picked from commitc65592c)Co-authored-by: htsedebenham <31847376+htsedebenham@users.noreply.github.com>
ambv pushed a commit that referenced this pull requestJul 23, 2023
…valid multipart emails when parsing header only (GH-107016) (#107112)(cherry picked from commitc65592c)Co-authored-by: htsedebenham <31847376+htsedebenham@users.noreply.github.com>
jtcave pushed a commit to jtcave/cpython that referenced this pull requestJul 23, 2023
mementum pushed a commit to mementum/cpython that referenced this pull requestJul 23, 2023
Sign up for freeto join this conversation on GitHub. Already have an account?Sign in to comment

Reviewers

No reviews

Assignees

No one assigned

Labels

None yet

Projects

None yet

Milestone

No milestone

Development

Successfully merging this pull request may close these issues.

4 participants

@htsedebenham@bedevere-bot@miss-islington@ambv

[8]ページ先頭

©2009-2025 Movatter.jp