Fix message preview in mailqueue model
authorMagnus Hagander <magnus@hagander.net>
Fri, 3 Jul 2020 15:51:01 +0000 (17:51 +0200)
committerMagnus Hagander <magnus@hagander.net>
Fri, 3 Jul 2020 16:05:47 +0000 (18:05 +0200)
UTF8 encoding issues since the python3 migration...

pgweb/mailqueue/admin.py

index 6b89205cc970c8f1e1122d6a0d55fb8c2dc6b657..468283b6036778975cc5114de0d840f26fe71e77 100644 (file)
@@ -17,13 +17,13 @@ class QueuedMailAdmin(admin.ModelAdmin):
             msg = parser.parsestr(obj.fullmsg)
             b = msg.get_payload(decode=True)
             if b:
-                return b
+                return b.decode('utf8')
 
             pl = msg.get_payload()
             for p in pl:
                 b = p.get_payload(decode=True)
                 if b:
-                    return b
+                    return b.decode('utf8')
             return "Could not find body"
         except Exception as e:
             return "Failed to get body: %s" % e