diff options
author | R David Murray <rdmurray@bitdance.com> | 2012-08-24 15:14:13 (GMT) |
---|---|---|
committer | R David Murray <rdmurray@bitdance.com> | 2012-08-24 15:14:13 (GMT) |
commit | 638d40b4337808f5e7c3f415f49270185c893321 (patch) | |
tree | 6dccf92953e8c51f1cceabae459d1f557abc22d1 /Lib/email/generator.py | |
parent | f2b34b8b9669598d4294488cf3bb8ab4465b7097 (diff) | |
download | cpython-638d40b4337808f5e7c3f415f49270185c893321.zip cpython-638d40b4337808f5e7c3f415f49270185c893321.tar.gz cpython-638d40b4337808f5e7c3f415f49270185c893321.tar.bz2 |
#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/generator.py')
-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 02487e3..c6bfb70 100644 --- a/Lib/email/generator.py +++ b/Lib/email/generator.py @@ -391,6 +391,8 @@ class BytesGenerator(Generator): if msg._payload is None: return if _has_surrogates(msg._payload): + if self._mangle_from_: + msg._payload = fcre.sub(">From ", msg._payload) self.write(msg._payload) else: super(BytesGenerator,self)._handle_text(msg) |