From: Oleg Broytman Date: Sat, 1 Feb 2014 17:36:19 +0000 (+0400) Subject: Fix a bug - do not generate 'From ' headers in subparts X-Git-Tag: v2.3.2~2 X-Git-Url: https://git.phdru.name/?a=commitdiff_plain;h=51b00f3c1674ff5995e11d9da108ce3da96e1bb2;p=mimedecode.git Fix a bug - do not generate 'From ' headers in subparts --- 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: