summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTomás Touceda <chiiph@leap.se>2014-01-22 18:42:12 -0300
committerTomás Touceda <chiiph@leap.se>2014-01-22 18:42:12 -0300
commit460539c51b431b6d16c45ecd8216ab1e0471d106 (patch)
tree0277c42343dd1ff456818753ca4d83b438c007db
parentb07cea9374b9eb382fc18897bbb3df31efd54bb7 (diff)
Properly parse apple mail
-rw-r--r--changes/bug_properly_parse_apple_mails1
-rw-r--r--src/leap/mail/walk.py9
2 files changed, 10 insertions, 0 deletions
diff --git a/changes/bug_properly_parse_apple_mails b/changes/bug_properly_parse_apple_mails
new file mode 100644
index 0000000..1bf42ae
--- /dev/null
+++ b/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/src/leap/mail/walk.py b/src/leap/mail/walk.py
index dd3b745..27d672c 100644
--- a/src/leap/mail/walk.py
+++ b/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: