Skip to content

Commit

Permalink
fix(mail): Removed attachements of images when replying to a mail. As…
Browse files Browse the repository at this point in the history
… the image is inline, the attachement shall be removed.
  • Loading branch information
WoodySlum committed Apr 3, 2023
1 parent 6acb245 commit 0edd3f7
Showing 1 changed file with 14 additions and 5 deletions.
19 changes: 14 additions & 5 deletions UI/MailerUI/UIxMailEditor.m
Original file line number Diff line number Diff line change
Expand Up @@ -721,11 +721,20 @@ - (void) setBase64ImagesInText:(SOGoDraftObject *) draft
contentId = [contentId stringByReplacingOccurrencesOfString: @">" withString: @""];

if ([[mime encoding] isEqualToString: @"base64"] && contentId) {
lText = [text stringByReplacingOccurrencesOfString: contentId
withString: [NSString stringWithFormat: @"data:%@;base64,%@",
[[mime contentType] stringValue],
[NSString stringWithUTF8String: [[mime body] bytes]]]];
[self setText: lText];
if ([text rangeOfString: contentId].location != NSNotFound) {
lText = [text stringByReplacingOccurrencesOfString: contentId
withString: [NSString stringWithFormat: @"data:%@;base64,%@",
[[mime contentType] stringValue],
[NSString stringWithUTF8String: [[mime body] bytes]]]];
[self setText: lText];
[draft deleteAttachmentWithName: [draftFileAttachement objectForKey:@"filename"]];
} else {
// This is an attachment with no CID in message body
if ([draft inReplyTo]) {
// If the image has no CID and the draft is a reply (not forward, the images in attachement should be removed)
[draft deleteAttachmentWithName: [draftFileAttachement objectForKey:@"filename"]];
}
}
} else {
[self warnWithFormat: @"Empty content id [1] : %@", contentId];
}
Expand Down

0 comments on commit 0edd3f7

Please sign in to comment.