mirror of
https://github.com/inverse-inc/sogo.git
synced 2026-04-23 05:49:31 +00:00
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:
@@ -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];
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user