summaryrefslogtreecommitdiff
path: root/src/leap
diff options
context:
space:
mode:
authorSimon Fondrie-Teitler <simonft@riseup.net>2017-09-29 12:12:23 -0400
committerKali Kaneko <kali@leap.se>2017-10-11 23:34:54 +0200
commit7ded13dafb6a29dcbbbabc32008685db49d42f77 (patch)
tree4299a22ffd8d9344f88f507f2336693f63a7565a /src/leap
parent59f0e2b83d982ac1a83a29ef2ac4bf34a1862adf (diff)
[bug] Keep content-type when it is set in message headers
When content-type was set in the message headers instead of the MIMEPart (e.g. when not using MIMEParts in the message) bitmask would ignore it and add the content as text/plain. This caused problems with Nylas. To fix this, if the message is not Multipart I'm keeping the assumption that everything is going to have the maintype of "text" but copying the subtype from the original message. This also decodes the original message's payload before attaching the old content to the new message to make up for the loss of encoding information. -Resolves: #9064
Diffstat (limited to 'src/leap')
-rw-r--r--src/leap/bitmask/mail/outgoing/service.py3
1 files changed, 2 insertions, 1 deletions
diff --git a/src/leap/bitmask/mail/outgoing/service.py b/src/leap/bitmask/mail/outgoing/service.py
index 86fb63c..18d266e 100644
--- a/src/leap/bitmask/mail/outgoing/service.py
+++ b/src/leap/bitmask/mail/outgoing/service.py
@@ -342,7 +342,8 @@ class OutgoingMail(object):
msg = MIMEMultipart()
for h, v in origmsg.items():
msg.add_header(h, v)
- msg.attach(MIMEText(origmsg.get_payload()))
+ msg.attach(MIMEText(origmsg.get_payload(decode=True),
+ origmsg.get_content_subtype()))
keymsg = MIMEApplication(from_key.key_data, _subtype='pgp-keys',
_encoder=lambda x: x)