summaryrefslogtreecommitdiff
path: root/Lib/email
diff options
context:
space:
mode:
authorR David Murray <rdmurray@bitdance.com>2012-08-24 11:23:50 -0400
committerR David Murray <rdmurray@bitdance.com>2012-08-24 11:23:50 -0400
commitbdcaa49116d652cff270e0677d1cca931cd45aaf (patch)
treefdb0b9aeb7e019f6f53063b863fb4d15a7a57643 /Lib/email
parent5a0429557fc7dd4a41680abe24ea12307222cb2e (diff)
parent3b1106a4f31a8690a991fe5cdef442a4e5d4a41f (diff)
downloadcpython-bdcaa49116d652cff270e0677d1cca931cd45aaf.tar.gz
Merge #15249: Mangle From lines correctly when body contains invalid bytes.
Fix by Colin Su. Test by me, based on a test written by Petri Lehtinen.
Diffstat (limited to 'Lib/email')
-rw-r--r--Lib/email/generator.py2
1 files changed, 2 insertions, 0 deletions
diff --git a/Lib/email/generator.py b/Lib/email/generator.py
index 8413f3b9a8..899adbc7af 100644
--- a/Lib/email/generator.py
+++ b/Lib/email/generator.py
@@ -400,6 +400,8 @@ class BytesGenerator(Generator):
if msg._payload is None:
return
if _has_surrogates(msg._payload) and not self.policy.cte_type=='7bit':
+ if self._mangle_from_:
+ msg._payload = fcre.sub(">From ", msg._payload)
self.write(msg._payload)
else:
super(BytesGenerator,self)._handle_text(msg)