]> granicus.if.org Git - python/commit
bpo-33972: Fix EmailMessage.iter_attachments raising AttributeError. (GH-14119)
authorAbhilash Raj <maxking@users.noreply.github.com>
Tue, 25 Jun 2019 17:03:19 +0000 (10:03 -0700)
committerBarry Warsaw <barry@python.org>
Tue, 25 Jun 2019 17:03:19 +0000 (10:03 -0700)
commit02257012f6d3821d816cb6a7e8461a88a05b9a08
tree62ddd6ec0b021a615997180039f90d829ff2edc6
parentd7c87d982d4ec4ba201bcee14324ae5e0e90581f
bpo-33972: Fix EmailMessage.iter_attachments raising AttributeError. (GH-14119)

* bpo-33972: Fix EmailMessage.iter_attachments raising AttributeError.

When certain malformed messages have content-type set to 'mulitpart/*' but
still have a single part body, iter_attachments can raise AttributeError. This
patch fixes it by returning a None value instead when the body is single part.
Lib/email/message.py
Lib/test/test_email/test_message.py
Misc/NEWS.d/next/Library/2019-06-15-14-39-50.bpo-33972.XxnNPw.rst [new file with mode: 0644]