diff options
-rw-r--r-- | Lib/email/message.py | 1 | ||||
-rw-r--r-- | Lib/email/test/data/msg_10.txt | 7 | ||||
-rw-r--r-- | Lib/email/test/test_email.py | 6 | ||||
-rw-r--r-- | Misc/ACKS | 1 |
4 files changed, 13 insertions, 2 deletions
diff --git a/Lib/email/message.py b/Lib/email/message.py index d89e37e..3608d1a 100644 --- a/Lib/email/message.py +++ b/Lib/email/message.py @@ -204,7 +204,6 @@ class Message: if isinstance(payload, str): payload = payload.encode('raw-unicode-escape') return base64.b64decode(payload) - #return utils._bdecode(payload) except binascii.Error: # Incorrect padding pass diff --git a/Lib/email/test/data/msg_10.txt b/Lib/email/test/data/msg_10.txt index bd30d13..0790396 100644 --- a/Lib/email/test/data/msg_10.txt +++ b/Lib/email/test/data/msg_10.txt @@ -26,6 +26,13 @@ VGhpcyBpcyBhIEJhc2U2NCBlbmNvZGVkIG1lc3NhZ2Uu --BOUNDARY Content-Type: text/plain; charset="iso-8859-1" +Content-Transfer-Encoding: Base64 + +VGhpcyBpcyBhIEJhc2U2NCBlbmNvZGVkIG1lc3NhZ2UuCg== + + +--BOUNDARY +Content-Type: text/plain; charset="iso-8859-1" This has no Content-Transfer-Encoding: header. diff --git a/Lib/email/test/test_email.py b/Lib/email/test/test_email.py index 27ddc7c..5e4d9ba 100644 --- a/Lib/email/test/test_email.py +++ b/Lib/email/test/test_email.py @@ -204,8 +204,12 @@ class TestMessageAPI(TestEmailBase): # Subpart 3 is base64 eq(msg.get_payload(2).get_payload(decode=True), b'This is a Base64 encoded message.') - # Subpart 4 has no Content-Transfer-Encoding: header. + # Subpart 4 is base64 with a trailing newline, which + # used to be stripped (issue 7143). eq(msg.get_payload(3).get_payload(decode=True), + b'This is a Base64 encoded message.\n') + # Subpart 5 has no Content-Transfer-Encoding: header. + eq(msg.get_payload(4).get_payload(decode=True), b'This has no Content-Transfer-Encoding: header.\n') def test_get_decoded_uu_payload(self): @@ -9,6 +9,7 @@ Without you, I would've stopped working on Python long ago! PS: In the standard Python distribution, this file is encoded in UTF-8. +Joaquin Cuenca Abela David Abrahams Jim Ahlstrom Farhan Ahmad |