diff options
author | R David Murray <rdmurray@bitdance.com> | 2012-08-24 15:23:50 (GMT) |
---|---|---|
committer | R David Murray <rdmurray@bitdance.com> | 2012-08-24 15:23:50 (GMT) |
commit | ad2a7d528acbb94bd4def418201d808226cb9f38 (patch) | |
tree | bb89cf1c60d3ed576302ad517502f3cea06e0d5f /Lib/email | |
parent | 4784e0267e1a7debce8c0f62ce245ea2e680f733 (diff) | |
parent | 638d40b4337808f5e7c3f415f49270185c893321 (diff) | |
download | cpython-ad2a7d528acbb94bd4def418201d808226cb9f38.zip cpython-ad2a7d528acbb94bd4def418201d808226cb9f38.tar.gz cpython-ad2a7d528acbb94bd4def418201d808226cb9f38.tar.bz2 |
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.py | 2 |
1 files changed, 2 insertions, 0 deletions
diff --git a/Lib/email/generator.py b/Lib/email/generator.py index 8413f3b..899adbc 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) |