summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKali Kaneko <kali@leap.se>2015-07-10 12:47:21 -0400
committerRuben Pollan <meskio@sindominio.net>2015-07-13 11:55:30 -0400
commita18a74252337093f9dd3f474bc88bee241242182 (patch)
tree19471c0761d315575d075b4cd5dcf95169e9712d
parentf8155d8fec6a16d7841f8102815cc939e68bad15 (diff)
[bug] fix keyerror when inserting msg on pending_inserts dict
The decission to index the pending_inserts dict by message-id is a bit brittle. I assume any well-formed message in the RealWorld (tm) will have this header, but many samples used in the tests will break this assumption.
-rw-r--r--mail/src/leap/mail/mail.py5
1 files changed, 3 insertions, 2 deletions
diff --git a/mail/src/leap/mail/mail.py b/mail/src/leap/mail/mail.py
index 772b6db3..feed11b5 100644
--- a/mail/src/leap/mail/mail.py
+++ b/mail/src/leap/mail/mail.py
@@ -638,8 +638,9 @@ class MessageCollection(object):
notify_just_mdoc = False
if notify_just_mdoc:
- msgid = headers['message-id']
- self._pending_inserts[msgid] = defer.Deferred()
+ msgid = headers.get('message-id')
+ if msgid:
+ self._pending_inserts[msgid] = defer.Deferred()
if not self.is_mailbox_collection():
raise NotImplementedError()