diff roundup/mailgw.py @ 5547:081be318661b

Do not transcode binary email attachments (issue2551004). Only transcode attachments if a charset is specified or if they have a text/* content-type.
author Joseph Myers <jsm@polyomino.org.uk>
date Wed, 26 Sep 2018 01:24:19 +0000
parents 29346d92d80c
children cacef71b3a54
line wrap: on
line diff
--- a/roundup/mailgw.py	Tue Sep 25 17:06:18 2018 +0200
+++ b/roundup/mailgw.py	Wed Sep 26 01:24:19 2018 +0000
@@ -241,7 +241,8 @@
 
         if content is not None:
             charset = self.get_content_charset()
-            content = u2s(content.decode(charset or 'iso8859-1', 'replace'))
+            if charset or self.get_content_maintype() == 'text':
+                content = u2s(content.decode(charset or 'iso8859-1', 'replace'))
 
         return content
 

Roundup Issue Tracker: http://roundup-tracker.org/