From f18fcf1649debaf1ddf382c8657e5b5256cbd7b7 Mon Sep 17 00:00:00 2001 From: Jefferson Stachelski Date: Tue, 10 Nov 2015 12:02:29 -0200 Subject: Fix the problem when leap doesn't found body_phash --- service/pixelated/adapter/mailstore/leap_mailstore.py | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) (limited to 'service/pixelated/adapter/mailstore/leap_mailstore.py') 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 -- cgit v1.2.3