[3.12] gh-106186: Don't report MultipartInvariantViolationDefect for valid multipart emails when parsing header only (GH-107016) (#107111)

(cherry picked from commit c65592c4d6)

Co-authored-by: htsedebenham <31847376+htsedebenham@users.noreply.github.com>
This commit is contained in:
Miss Islington (bot) 2023-07-23 05:28:28 -07:00 committed by GitHub
parent 95a82dcbe7
commit af95a1da46
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
4 changed files with 28 additions and 1 deletions

View file

@ -187,7 +187,7 @@ class FeedParser:
assert not self._msgstack
# Look for final set of defects
if root.get_content_maintype() == 'multipart' \
and not root.is_multipart():
and not root.is_multipart() and not self._headersonly:
defect = errors.MultipartInvariantViolationDefect()
self.policy.handle_defect(root, defect)
return root