summaryrefslogtreecommitdiff
path: root/src/leap
diff options
context:
space:
mode:
authorKali Kaneko <kali@leap.se>2015-07-10 12:44:16 -0400
committerRuben Pollan <meskio@sindominio.net>2015-07-13 11:55:30 -0400
commit4ab5660b5c3a2fc29f2d08d06e1958fc91ee5af7 (patch)
treed45b0a6679040d3a645ab8d0ab3292c7a708e0c2 /src/leap
parent221a168e07a5d8ff32573c80ab2cad54d03d3038 (diff)
[bug] workaround for off-by-one error on nested multipart
For some reason that I haven't discovered yet, nested multipart is hitting an off-by-one error (that had been wrongly ammended in a previous commit, breaking many other cases but fixing the particular Mail.app sample I was working with). This is just a temporary hack to make all the current regression tests happy, but further investigation is needed to discover the cause of the off-by-one part retrieval solved and correctly documented.
Diffstat (limited to 'src/leap')
-rw-r--r--src/leap/mail/mail.py10
1 files changed, 10 insertions, 0 deletions
diff --git a/src/leap/mail/mail.py b/src/leap/mail/mail.py
index 0aede6b..772b6db 100644
--- a/src/leap/mail/mail.py
+++ b/src/leap/mail/mail.py
@@ -211,6 +211,16 @@ class MessagePart(object):
raise TypeError
sub_pmap = self._pmap.get("part_map", {})
+
+ # XXX BUG --- workaround. Subparts with more than 1 subparts
+ # need to get the requested index for the subpart decremented.
+ # Off-by-one error, should investigate which is the real reason and
+ # fix it, this is only a quick workaround.
+ num_parts = self._pmap.get("parts", 0)
+ if num_parts > 1:
+ part = part - 1
+ # -------------------------------------------------------------
+
try:
part_map = sub_pmap[str(part)]
except KeyError: