mirror of
https://github.com/inverse-inc/sogo.git
synced 2026-10-05 20:10:33 +00:00
fix(mail): Fix duplication of images when saving draft. Fixes #5888. Clean old code
This commit is contained in:
@@ -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>).
|
||||
|
||||
Reference in New Issue
Block a user