From ed3f7942260a35124e21a4396a6fd756de7ef060 Mon Sep 17 00:00:00 2001 From: Francis Lachapelle Date: Thu, 6 Apr 2017 14:31:41 -0400 Subject: [PATCH] Fix attachment path when inside multiple parts --- NEWS | 1 + UI/MailPartViewers/UIxMailPartViewer.m | 13 +++++++++++-- 2 files changed, 12 insertions(+), 2 deletions(-) diff --git a/NEWS b/NEWS index 516b096d2..a281811af 100644 --- a/NEWS +++ b/NEWS @@ -8,6 +8,7 @@ Enhancements - Bug fixes + - [web] fixed attachment path when inside multiple body parts - [core] cherry-picked comma escaping fix from v2 (#3296) 3.2.8 (2017-03-24) diff --git a/UI/MailPartViewers/UIxMailPartViewer.m b/UI/MailPartViewers/UIxMailPartViewer.m index 111005c1f..9904e69fc 100644 --- a/UI/MailPartViewers/UIxMailPartViewer.m +++ b/UI/MailPartViewers/UIxMailPartViewer.m @@ -340,12 +340,21 @@ - (NSString *) pathToAttachmentFromMessage { + NSMutableArray *parts; SOGoMailBodyPart *bodyPart; bodyPart = [self clientPart]; - if ([bodyPart isKindOfClass: [SOGoMailBodyPart class]]) - return [NSString stringWithFormat: @"%@/%@", [bodyPart nameInContainer], [self _filenameForAttachment: bodyPart]]; + { + parts = [NSMutableArray arrayWithObject: [self _filenameForAttachment: bodyPart]]; + do + { + [parts insertObject: [bodyPart nameInContainer] atIndex: 0]; + bodyPart = [bodyPart container]; + } + while ([bodyPart isKindOfClass: [SOGoMailBodyPart class]]); + return [parts componentsJoinedByString: @"/"]; + } return @"0"; }