summaryrefslogtreecommitdiffstats
path: root/Lib/email/utils.py
diff options
context:
space:
mode:
authorR. David Murray <rdmurray@bitdance.com>2010-03-08 02:04:06 (GMT)
committerR. David Murray <rdmurray@bitdance.com>2010-03-08 02:04:06 (GMT)
commit4617e5085a89952a0bc99c086e5de8dc9f0a5676 (patch)
tree0c5339d472b54a79a5adc0ed585eb3eabc52d084 /Lib/email/utils.py
parent16cd888dd9fa4dc2da642a8edb45e708e296a086 (diff)
downloadcpython-4617e5085a89952a0bc99c086e5de8dc9f0a5676.zip
cpython-4617e5085a89952a0bc99c086e5de8dc9f0a5676.tar.gz
cpython-4617e5085a89952a0bc99c086e5de8dc9f0a5676.tar.bz2
Issue #7143: get_payload used to strip any trailing newline from a
base64 transfer-encoded payload *after* decoding it; it no longer does. email had a special method in utils, _bdecode, specifically to do this, so it must have served a purpose at some point, yet it is clearly wrong per RFC. Fixed with Barry's approval, but no backport. Email package minor version number is bumped, now version 4.0.1. Patch by Joaquin Cuenca Abela.
Diffstat (limited to 'Lib/email/utils.py')
-rw-r--r--Lib/email/utils.py13
1 files changed, 7 insertions, 6 deletions
diff --git a/Lib/email/utils.py b/Lib/email/utils.py
index b9a7642..6d22ca7 100644
--- a/Lib/email/utils.py
+++ b/Lib/email/utils.py
@@ -60,14 +60,15 @@ def _identity(s):
def _bdecode(s):
- # We can't quite use base64.encodestring() since it tacks on a "courtesy
- # newline". Blech!
+ """Decodes a base64 string.
+
+ This function is equivalent to base64.decodestring and it's retained only
+ for backward compatibility. It used to remove the last \n of the decoded
+ string, if it had any (see issue 7143).
+ """
if not s:
return s
- value = base64.decodestring(s)
- if not s.endswith('\n') and value.endswith('\n'):
- return value[:-1]
- return value
+ return base64.decodestring(s)