fix(mail): Fix duplication of images when saving draft. Fixes #5888. Clean old code

This commit is contained in:
smizrahi
2023-11-01 10:29:25 +01:00
parent 4fe01f96d7
commit 9c0948518b
+1 -47
View File
@@ -932,7 +932,6 @@ static NSString *userAgent = nil;
if (filename)
{
NSMutableDictionary *currentInfo;
currentInfo = [NSMutableDictionary dictionaryWithObjectsAndKeys:
filename, @"filename",
mimeType, @"mimetype",
@@ -1955,53 +1954,8 @@ static NSString *userAgent = nil;
}
}
if (_extractImages)
{
int i;
for (i = 0 ; i < [extractedBodyParts count] ; i++) {
NSMutableDictionary *currentInfo;
NSString *filename, *mimeType, *bodyId, *encoding;
NSData *body;
NGMimeBodyPart *extractedBodyPart;
NGMimeContentDispositionHeaderField *contentDisposition;
extractedBodyPart = [extractedBodyParts objectAtIndex:i];
if (extractedBodyPart && [extractedBodyPart headerForKey: @"content-disposition"]) {
encoding = [extractedBodyPart encoding];
contentDisposition = [[NGMimeContentDispositionHeaderField alloc] initWithString: [extractedBodyPart headerForKey: @"content-disposition"]];
if (encoding
&& [extractedBodyPart contentType]
&& [extractedBodyPart contentId]
&& [contentDisposition filename]) {
mimeType = [[extractedBodyPart contentType] stringValue];
bodyId = [[extractedBodyPart contentId] stringValue];
filename = [contentDisposition filename];
currentInfo = [NSMutableDictionary dictionaryWithObjectsAndKeys:
filename, @"filename",
mimeType, @"mimetype",
bodyId, @"bodyId",
nil];
if ([[extractedBodyParts objectAtIndex:i] body]) {
if (encoding && [encoding rangeOfString:@"base64"].location != NSNotFound)
body = [[[extractedBodyParts objectAtIndex:i] body] dataByDecodingBase64];
else
body = [[extractedBodyParts objectAtIndex:i] body];
[self saveAttachment: body
withMetadata: currentInfo];
}
}
[contentDisposition release];
}
}
}
return message;
}
}
//
// Return a NGMimeMessage object with inline HTML images (<img src=data>) extracted as attachments (<img src=cid>).