From 9b320ec2a175f1db74a410b8a34767b4c28951e7 Mon Sep 17 00:00:00 2001 From: Ludovic Marcotte Date: Tue, 31 Mar 2015 16:17:21 -0400 Subject: [PATCH] Improvements over 491d7aaffcc2fc2b8acb468e6387501c2af376e4 --- ActiveSync/SOGoMailObject+ActiveSync.m | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/ActiveSync/SOGoMailObject+ActiveSync.m b/ActiveSync/SOGoMailObject+ActiveSync.m index 1d74830c6..15e3b1ca7 100644 --- a/ActiveSync/SOGoMailObject+ActiveSync.m +++ b/ActiveSync/SOGoMailObject+ActiveSync.m @@ -224,9 +224,17 @@ struct GlobalObjectId { while ((key = [e nextObject])) { - // don't use body parts from a nested body - e.g. body of type message/rfc822 - if (![key hasPrefix: @"1"]) + // Don't use body parts from nested bodies if not of type multipart/alternative. - e.g. body of type message/rfc822 + // Use only parts of level 0 or 1. + if ([key countOccurrencesOfString: @"."] > 1) continue; + else if ([key countOccurrencesOfString: @"."] == 1) + { + // Ignore nested parts if the container is not of type multipart/alternative. + part = [self lookupInfoForBodyPart: [[key componentsSeparatedByString: @"."] objectAtIndex:0]]; + if (!([[part valueForKey: @"type"] isEqualToString: @"multipart"] && [[part valueForKey: @"subtype"] isEqualToString: @"alternative"])) + continue; + } part = [self lookupInfoForBodyPart: key]; type = [part valueForKey: @"type"];