diff options
-rw-r--r-- | service/pixelated/adapter/mailstore/leap_mailstore.py | 6 |
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 |