From 33b2406bf153da7c72bab83c1e4a6b1d99c8cd15 Mon Sep 17 00:00:00 2001 From: tfux Date: Thu, 18 Nov 2021 18:44:13 +0100 Subject: [PATCH] fix(eas): handle attachments of type message/rfc822 when sanitize emails (fixes #5427) (#304) --- ActiveSync/SOGoMailObject+ActiveSync.m | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/ActiveSync/SOGoMailObject+ActiveSync.m b/ActiveSync/SOGoMailObject+ActiveSync.m index efe8fdfe0..fe7e9fea8 100644 --- a/ActiveSync/SOGoMailObject+ActiveSync.m +++ b/ActiveSync/SOGoMailObject+ActiveSync.m @@ -427,7 +427,7 @@ struct GlobalObjectId { body = [thePart body]; - if ([body isKindOfClass: [NGMimeMultipartBody class]]) + if ([body isKindOfClass: [NGMimeMultipartBody class]] || [body isKindOfClass: [NGMimeMessage class]]) { [self _sanitizedMIMEPart: body performed: b]; @@ -479,8 +479,7 @@ struct GlobalObjectId { RELEASE(fdata); *b = YES; } - else if ([[(NGMimeContentDispositionHeaderField *)[thePart headerForKey: @"content-disposition"] type] hasPrefix: @"attachment"] || - [[(NGMimeContentDispositionHeaderField *)[thePart headerForKey: @"content-disposition"] type] hasPrefix: @"inline"]) + else if ([body isKindOfClass: [NSData class]]) { [thePart setHeader: @"base64" forKey: @"content-transfer-encoding"]; [thePart setBody: [body dataByEncodingBase64]];