summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTulio Casagrande <tcasagra@thoughtworks.com>2016-06-16 16:37:01 -0300
committerTulio Casagrande <tcasagra@thoughtworks.com>2016-06-16 16:37:01 -0300
commitf5cf17f34227f8fe391d769f3cb33aad6de5172e (patch)
treea0a61c56b2858f2500c7653d1aadb7e44878ee3f
parent3922d64bb72bcd18cf8454316493c690c5b227b8 (diff)
Stops filtering application/pgp-keys attachments
See: #608
-rw-r--r--service/pixelated/adapter/mailstore/leap_mailstore.py7
-rw-r--r--service/test/integration/test_leap_mailstore.py13
2 files changed, 0 insertions, 20 deletions
diff --git a/service/pixelated/adapter/mailstore/leap_mailstore.py b/service/pixelated/adapter/mailstore/leap_mailstore.py
index 9699f134..70b53c37 100644
--- a/service/pixelated/adapter/mailstore/leap_mailstore.py
+++ b/service/pixelated/adapter/mailstore/leap_mailstore.py
@@ -29,9 +29,6 @@ from pixelated.support.functional import to_unicode
from pixelated.support import date
-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
@@ -323,14 +320,10 @@ 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_public_keys_from_attachments(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_public_keys_from_attachments(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))
diff --git a/service/test/integration/test_leap_mailstore.py b/service/test/integration/test_leap_mailstore.py
index f52d7c9c..07ab0b44 100644
--- a/service/test/integration/test_leap_mailstore.py
+++ b/service/test/integration/test_leap_mailstore.py
@@ -50,19 +50,6 @@ class LeapMailStoreTest(SoledadTestBase):
self.assertEqual(expected_mail_dict['header'], fetched_mail.as_dict()['header'])
@defer.inlineCallbacks
- def test_remove_key_from_attachments(self):
- input_mail = MIMEMultipart()
- input_mail.attach(MIMEText(u'a utf8 message', _charset='utf-8'))
- attachment = MIMEApplication('pretend to be binary attachment data')
- attachment.add_header('Content-Disposition', 'attachment', filename='pub.key')
- attachment.replace_header('Content-Type', 'application/pgp-keys')
- input_mail.attach(attachment)
-
- mail = yield self.mail_store.add_mail('INBOX', input_mail.as_string())
- fetched_mail = yield self.mail_store.get_mail(mail.ident, include_body=True)
- self.assertEquals(fetched_mail.as_dict().get('attachments'), [])
-
- @defer.inlineCallbacks
def test_round_trip_through_soledad_keeps_attachment(self):
input_mail = MIMEMultipart()
input_mail.attach(MIMEText(u'a utf8 message', _charset='utf-8'))