summaryrefslogtreecommitdiff
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
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
-rw-r--r--docs/changelog.rst1
-rw-r--r--src/leap/bitmask/mail/outgoing/service.py3
2 files changed, 3 insertions, 1 deletions
diff --git a/docs/changelog.rst b/docs/changelog.rst
index d197eded..99821b44 100644
--- a/docs/changelog.rst
+++ b/docs/changelog.rst
@@ -13,6 +13,7 @@ Features
Bugfixes
~~~~~~~~
- `#9099 <https://0xacab.org/leap/bitmask-dev/issues/9099>`_: properly check for openvpn binary path in bundles.
+- `#9064 <https://0xacab.org/leap/bitmask-dev/issues/9064>`_: keep content-type when it is set in message headers.
- Ship cacert.pem inside Bitmask.app
- Avoid importing linux-specific constants in firewall helpers.
diff --git a/src/leap/bitmask/mail/outgoing/service.py b/src/leap/bitmask/mail/outgoing/service.py
index 86fb63c2..18d266ef 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)