Keep filename from original part.

This commit is contained in:
Joshua Harlow
2013-07-20 14:57:42 -07:00
parent d7ed374081
commit e2c401dd16

View File

@@ -130,8 +130,12 @@ class UserDataProcessor(object):
# messages will expect a part not compressed.
if was_compressed:
maintype, subtype = ctype.split("/", 1)
part = MIMENonMultipart(maintype, subtype)
part.set_payload(payload)
n_part = MIMENonMultipart(maintype, subtype)
n_part.set_payload(payload)
if part.get_filename():
n_part.add_header('Content-Disposition', 'attachment',
filename=part.get_filename())
part = n_part
if ctype != ctype_orig:
replace_header(part, CONTENT_TYPE, ctype)