From 65f9d0316e981f6ba6423ff8c73cbe94249b596c Mon Sep 17 00:00:00 2001 From: Kali Kaneko Date: Wed, 29 Jan 2014 16:43:15 -0400 Subject: Fix indexing error that was rendering attachments unusable Also, check for empty body-doc --- mail/src/leap/mail/imap/messages.py | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'mail') diff --git a/mail/src/leap/mail/imap/messages.py b/mail/src/leap/mail/imap/messages.py index 5770868..2ace103 100644 --- a/mail/src/leap/mail/imap/messages.py +++ b/mail/src/leap/mail/imap/messages.py @@ -301,7 +301,7 @@ class LeapMessage(fields, MailParser, MBoxParser): fd = StringIO.StringIO() if self._bdoc is not None: bdoc_content = self._bdoc.content - if bdoc_content is None: + if empty(bdoc_content): logger.warning("No BDOC content found for message!!!") return write_fd("") @@ -906,9 +906,10 @@ class MessageCollection(WithMsgFields, IndexedDB, MailParser, MBoxParser): hd[key] = parts_map[key] del parts_map - # The MessageContainer expects a dict, zero-indexed + # The MessageContainer expects a dict, one-indexed # XXX review-me - cdocs = dict(enumerate(walk.get_raw_docs(msg, parts))) + cdocs = dict(((key + 1, doc) for key, doc in + enumerate(walk.get_raw_docs(msg, parts)))) self.set_recent_flag(uid) @@ -960,7 +961,6 @@ class MessageCollection(WithMsgFields, IndexedDB, MailParser, MBoxParser): fields.RECENTFLAGS_KEY, [])) return self.__rflags - @profile def _set_recent_flags(self, value): """ Setter for the recent-flags set for this mailbox. -- cgit v1.2.3