mirror of
https://github.com/inverse-inc/sogo.git
synced 2026-02-17 07:33:57 +00:00
fix(eas): use base64 encoding for attachments when sanitize emails + content-length
Fixes #5408
This commit is contained in:
@@ -60,6 +60,7 @@ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
#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>
|
||||
@@ -478,6 +479,14 @@ struct GlobalObjectId {
|
||||
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"];
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user