]> git.ipfire.org Git - thirdparty/Python/cpython.git/commit
[3.7] bpo-33972: Fix EmailMessage.iter_attachments raising AttributeError. (GH-14119...
authorAbhilash Raj <maxking@users.noreply.github.com>
Tue, 25 Jun 2019 18:40:41 +0000 (11:40 -0700)
committerMiss Islington (bot) <31488909+miss-islington@users.noreply.github.com>
Tue, 25 Jun 2019 18:40:41 +0000 (11:40 -0700)
commit01b23948038d35b119cededd149110231ecce00d
treec65f3a0c18a25893c3df9130d5164fd8dbee4ae9
parent2a99fd911ebeecedbb250a05667cd46eca4735b9
[3.7] bpo-33972: Fix EmailMessage.iter_attachments raising AttributeError. (GH-14119) (GH-14381)

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.
(cherry picked from commit 02257012f6d3821d816cb6a7e8461a88a05b9a08)

Co-authored-by: Abhilash Raj <maxking@users.noreply.github.com>
https://bugs.python.org/issue33972
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]