summaryrefslogtreecommitdiff
path: root/service/pixelated/adapter/mailstore/leap_mailstore.py
diff options
context:
space:
mode:
authorGiovane <giovaneliberato@gmail.com>2016-02-22 14:39:10 -0300
committerGiovane <giovaneliberato@gmail.com>2016-02-22 14:39:10 -0300
commitf40a56b2c754ea9254a54b240d3e6ca8d5bd0b1d (patch)
tree669e86005bc4cafce725103cc0d7b18c30eedb27 /service/pixelated/adapter/mailstore/leap_mailstore.py
parent7c1affe11f7563911c34c9d439fe5ed1bf7c3a17 (diff)
Revert "Revert "Filter keys from attachments #608 w/ @deniscostadsc""
This reverts commit f92e802df2aeec9b2341ba5b4efea48356edf01f.
Diffstat (limited to 'service/pixelated/adapter/mailstore/leap_mailstore.py')
-rw-r--r--service/pixelated/adapter/mailstore/leap_mailstore.py7
1 files changed, 7 insertions, 0 deletions
diff --git a/service/pixelated/adapter/mailstore/leap_mailstore.py b/service/pixelated/adapter/mailstore/leap_mailstore.py
index 6cbbe10a..72a16dfa 100644
--- a/service/pixelated/adapter/mailstore/leap_mailstore.py
+++ b/service/pixelated/adapter/mailstore/leap_mailstore.py
@@ -29,6 +29,9 @@ from pixelated.support import log_time_deferred
from pixelated.support.functional import to_unicode
+MIME_PGP_KEY = 'application/pgp-keys'
+
+
class AttachmentInfo(object):
def __init__(self, ident, name, encoding=None, ctype='application/octet-stream', size=0):
self.ident = ident
@@ -322,10 +325,14 @@ class LeapMailStore(MailStore):
mbox_uuid = message.get_wrapper().fdoc.mbox_uuid
mbox_name = yield self._mailbox_name_from_uuid(mbox_uuid)
attachments = self._extract_attachment_info_from(message)
+ attachments = self._filter_keys(attachments)
mail = LeapMail(mail_id, mbox_name, message.get_wrapper().hdoc.headers, set(message.get_tags()), set(message.get_flags()), body=body, attachments=attachments) # TODO assert flags are passed on
defer.returnValue(mail)
+ def _filter_keys(self, attachments):
+ return filter(lambda attachment: attachment.ctype != MIME_PGP_KEY, attachments)
+
@defer.inlineCallbacks
def _raw_message_body(self, message):
content_doc = (yield message.get_wrapper().get_body(self.soledad))