diff options
author | Kali Kaneko <kali@leap.se> | 2015-01-27 11:18:04 -0400 |
---|---|---|
committer | Kali Kaneko <kali@leap.se> | 2015-02-11 14:05:44 -0400 |
commit | 77fc39f4d2690e3f9f9d1563179adf77c9db6da7 (patch) | |
tree | 66fb628bfd4b07ccbe8d19c7ee0260a6d3df7fb9 | |
parent | 2a86e0c830bc4f93a7f261eaa8324e80d8e25b5d (diff) |
return empty string if we couldn't find body
so the server doesn't choke.
-rw-r--r-- | mail/src/leap/mail/mail.py | 7 |
1 files changed, 2 insertions, 5 deletions
diff --git a/mail/src/leap/mail/mail.py b/mail/src/leap/mail/mail.py index 2766524..4306ec3 100644 --- a/mail/src/leap/mail/mail.py +++ b/mail/src/leap/mail/mail.py @@ -22,7 +22,6 @@ import logging import StringIO from twisted.internet import defer -from twisted.python import log from leap.common.check import leap_assert_type from leap.common.mail import get_email_charset @@ -31,7 +30,6 @@ from leap.mail.adaptors.soledad import SoledadMailAdaptor from leap.mail.constants import INBOX_NAME from leap.mail.constants import MessageFlags from leap.mail.mailbox_indexer import MailboxIndexer -from leap.mail.utils import empty # find_charset logger = logging.getLogger(name=__name__) @@ -211,9 +209,8 @@ class Message(object): Get a file descriptor with the body content. """ def write_and_rewind_if_found(cdoc): - if not cdoc: - return None - return _write_and_rewind(cdoc.raw) + payload = cdoc.raw if cdoc else "" + return _write_and_rewind(payload) d = defer.maybeDeferred(self._wrapper.get_body, store) d.addCallback(write_and_rewind_if_found) |