summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKali Kaneko <kali@leap.se>2014-01-23 02:50:36 -0400
committerKali Kaneko <kali@leap.se>2014-01-23 02:50:36 -0400
commit60335e19b6c9c94b64936e9824f704e41c01b459 (patch)
treee3729d210a0740f68423d96963e66e0cc88e89fa
parentccab7ac16dd40f822e2beafad4775dca90dd51b5 (diff)
parent5593be27282a0b79e8d1bb8f63a8d2e3648e3f1a (diff)
Merge remote-tracking branch 'chiiph/bug/properly_parse_apple_mail' into develop
-rw-r--r--mail/changes/bug_properly_parse_apple_mails1
-rw-r--r--mail/src/leap/mail/walk.py9
2 files changed, 10 insertions, 0 deletions
diff --git a/mail/changes/bug_properly_parse_apple_mails b/mail/changes/bug_properly_parse_apple_mails
new file mode 100644
index 00000000..1bf42ae5
--- /dev/null
+++ b/mail/changes/bug_properly_parse_apple_mails
@@ -0,0 +1 @@
+ o Properly parse emails crafted by Mail.app. Fixes #5013. \ No newline at end of file
diff --git a/mail/src/leap/mail/walk.py b/mail/src/leap/mail/walk.py
index dd3b7451..27d672c3 100644
--- a/mail/src/leap/mail/walk.py
+++ b/mail/src/leap/mail/walk.py
@@ -143,6 +143,15 @@ def walk_msg_tree(parts, body_phash=None):
pv = list(get_parts_vector(parts))
wv = getwv(pv)
+ if all(x == 1 for x in pv):
+ # special case in the rightmost element
+ main_pmap = parts[0]['part_map']
+ last_part = max(main_pmap.keys())
+ main_pmap[last_part]['part_map'] = {}
+ for partind in range(len(pv) - 1):
+ print partind+1, len(parts)
+ main_pmap[last_part]['part_map'][partind] = parts[partind+1]
+
outer = parts[0]
outer.pop('headers')
if not "part_map" in outer: