From 4a21a02f986d7330314a04dc5e33eb04c3f4ca1e Mon Sep 17 00:00:00 2001 From: Francis Lachapelle Date: Fri, 13 Jan 2017 12:23:38 -0500 Subject: [PATCH] Fix rendering of forwarded HTML message with img Fixes #3981 (cont'd) --- SoObjects/Mailer/SOGoMailObject.m | 1 + UI/MailPartViewers/UIxMailPartHTMLViewer.m | 3 ++- UI/MailerUI/UIxMailView.m | 7 ++++++- 3 files changed, 9 insertions(+), 2 deletions(-) diff --git a/SoObjects/Mailer/SOGoMailObject.m b/SoObjects/Mailer/SOGoMailObject.m index 41947964a..5f543af38 100644 --- a/SoObjects/Mailer/SOGoMailObject.m +++ b/SoObjects/Mailer/SOGoMailObject.m @@ -840,6 +840,7 @@ static BOOL debugSoParts = NO; path, @"path", [part objectForKey: @"encoding"], @"encoding", [part objectForKey:@ "size"], @"size", + [part objectForKey: @"bodyId"], @"bodyId", [NSString stringWithFormat: @"%@/%@", prefix, filenameURL], @"url", [NSString stringWithFormat: @"%@/asAttachment/%@", prefix, filenameURL], @"urlAsAttachment", nil]; diff --git a/UI/MailPartViewers/UIxMailPartHTMLViewer.m b/UI/MailPartViewers/UIxMailPartHTMLViewer.m index 54631f706..42366b037 100644 --- a/UI/MailPartViewers/UIxMailPartHTMLViewer.m +++ b/UI/MailPartViewers/UIxMailPartHTMLViewer.m @@ -609,7 +609,8 @@ static NSData* _sanitizeContent(NSData *theData) value = [_attributes valueAtIndex: count]; if ([value hasPrefix: @"cid:"]) { - cid = [value substringFromIndex: 4]; + cid = [NSString stringWithFormat: @"<%@>", + [value substringFromIndex: 4]]; value = [attachmentIds objectForKey: cid]; skipAttribute = (value == nil); } diff --git a/UI/MailerUI/UIxMailView.m b/UI/MailerUI/UIxMailView.m index 450af002c..091ec8214 100644 --- a/UI/MailerUI/UIxMailView.m +++ b/UI/MailerUI/UIxMailView.m @@ -215,6 +215,7 @@ static NSString *mailETag = nil; NSMutableDictionary *attachmentIds; NSDictionary *attributes; + NSString *filename; unsigned int count, max; max = [[self attachmentAttrs] count]; @@ -222,8 +223,12 @@ static NSString *mailETag = nil; for (count = 0; count < max; count++) { attributes = [[self attachmentAttrs] objectAtIndex: count]; + filename = [NSString stringWithFormat: @"<%@>", [attributes objectForKey: @"filename"]]; [attachmentIds setObject: [attributes objectForKey: @"url"] - forKey: [attributes objectForKey: @"filename"]]; + forKey: filename]; + if ([[attributes objectForKey: @"bodyId"] length]) + [attachmentIds setObject: [attributes objectForKey: @"url"] + forKey: [attributes objectForKey: @"bodyId"]]; } [viewer setAttachmentIds: attachmentIds];