fix(mail): Removed attachements of images when replying to a mail. As the image is inline, the attachement shall be removed.

This commit is contained in:
smizrahi
2023-04-03 19:11:53 +02:00
parent 6acb245fec
commit 0edd3f757f

View File

@@ -721,11 +721,20 @@ static NSArray *infoKeys = nil;
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];
}