From 51b00f3c1674ff5995e11d9da108ce3da96e1bb2 Mon Sep 17 00:00:00 2001 From: Oleg Broytman Date: Sat, 1 Feb 2014 21:36:19 +0400 Subject: [PATCH] Fix a bug - do not generate 'From ' headers in subparts --- mimedecode.py | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/mimedecode.py b/mimedecode.py index b1b18e3..b82d12f 100755 --- a/mimedecode.py +++ b/mimedecode.py @@ -133,7 +133,6 @@ def set_content_type(msg, newtype, charset=None): msg.set_param("charset", charset, "Content-Type") - caps = None # Globally stored mailcap database; initialized only if needed def decode_body(msg, s): @@ -193,7 +192,7 @@ def totext(msg, instring): "Convert instring content to text" if msg.is_multipart(): # Recursively decode all parts of the multipart message - newfile = StringIO(str(msg)) + newfile = StringIO(msg.as_string()) newfile.seek(0) decode_file(newfile) return @@ -276,7 +275,7 @@ def decode_file(infile): decode_part(msg) else: # Not a message, just text - copy it literally - output(str(msg)) + output(msg.as_string()) class GlobalOptions: -- 2.39.2