From 9c0948518b1e8365d6fadb3fccae1a0257b518ed Mon Sep 17 00:00:00 2001 From: smizrahi Date: Wed, 1 Nov 2023 10:29:25 +0100 Subject: [PATCH] fix(mail): Fix duplication of images when saving draft. Fixes #5888. Clean old code --- SoObjects/Mailer/SOGoDraftObject.m | 48 +----------------------------- 1 file changed, 1 insertion(+), 47 deletions(-) diff --git a/SoObjects/Mailer/SOGoDraftObject.m b/SoObjects/Mailer/SOGoDraftObject.m index 15bf83c88..02bfc08c4 100644 --- a/SoObjects/Mailer/SOGoDraftObject.m +++ b/SoObjects/Mailer/SOGoDraftObject.m @@ -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 () extracted as attachments ().