Skip to content

Commit

Permalink
fix(eas): use base64 encoding for attachments when sanitize emails + …
Browse files Browse the repository at this point in the history
…content-length

Fixes #5408
  • Loading branch information
tfux committed Oct 27, 2021
1 parent d751ad9 commit bfcb0b9
Showing 1 changed file with 9 additions and 0 deletions.
9 changes: 9 additions & 0 deletions ActiveSync/SOGoMailObject+ActiveSync.m
Expand Up @@ -60,6 +60,7 @@
#import <NGMime/NGMimeFileData.h>
#import <NGMime/NGMimeMultipartBody.h>
#import <NGMime/NGMimeType.h>
#import <NGMime/NGMimeHeaderFields.h>
#import <NGMail/NGMimeMessageParser.h>
#import <NGMail/NGMimeMessage.h>
#import <NGMail/NGMimeMessageGenerator.h>
Expand Down Expand Up @@ -478,6 +479,14 @@ - (void) _sanitizedMIMEPart: (id) thePart
RELEASE(fdata);
*b = YES;
}
else if ([[(NGMimeContentDispositionHeaderField *)[thePart headerForKey: @"content-disposition"] type] hasPrefix: @"attachment"] ||
[[(NGMimeContentDispositionHeaderField *)[thePart headerForKey: @"content-disposition"] type] hasPrefix: @"inline"])
{
[thePart setHeader: @"base64" forKey: @"content-transfer-encoding"];
[thePart setBody: [body dataByEncodingBase64]];
[thePart setHeader: [NSString stringWithFormat:@"%d", (int)[[thePart body] length]]
forKey: @"content-length"];
}
}
}

Expand Down

0 comments on commit bfcb0b9

Please sign in to comment.