summaryrefslogtreecommitdiff
path: root/service/pixelated
diff options
context:
space:
mode:
authorJefferson Stachelski <jstachel@thoughtworks.com>2015-11-10 12:02:29 -0200
committerJefferson Stachelski <jstachel@thoughtworks.com>2015-11-10 12:03:37 -0200
commitf18fcf1649debaf1ddf382c8657e5b5256cbd7b7 (patch)
tree37246f5c785c2bc8516ff93fad8eb7450963c94c /service/pixelated
parent78816e67fc1cd40fe23292904133d0a6d588e419 (diff)
Fix the problem when leap doesn't found body_phash
Diffstat (limited to 'service/pixelated')
-rw-r--r--service/pixelated/adapter/mailstore/leap_mailstore.py6
1 files changed, 5 insertions, 1 deletions
diff --git a/service/pixelated/adapter/mailstore/leap_mailstore.py b/service/pixelated/adapter/mailstore/leap_mailstore.py
index 519b124a..fc670382 100644
--- a/service/pixelated/adapter/mailstore/leap_mailstore.py
+++ b/service/pixelated/adapter/mailstore/leap_mailstore.py
@@ -355,7 +355,11 @@ class LeapMailStore(MailStore):
@defer.inlineCallbacks
def _raw_message_body(self, message):
content_doc = (yield message.get_wrapper().get_body(self.soledad))
- parser = BodyParser(content_doc.raw, content_type=content_doc.content_type, content_transfer_encoding=content_doc.content_transfer_encoding)
+ parser = BodyParser('', content_type='text/plain', content_transfer_encoding='UTF-8')
+ # It fix the problem when leap doesn'r found body_phash and returns empty string
+ if not isinstance(content_doc, str):
+ parser = BodyParser(content_doc.raw, content_type=content_doc.content_type, content_transfer_encoding=content_doc.content_transfer_encoding)
+
defer.returnValue(parser.parsed_content())
@defer.inlineCallbacks