mirror of
https://github.com/inverse-inc/sogo.git
synced 2026-07-06 08:55:08 +00:00
Improve handling of attachments names with quotes
Partially resolves #2272
This commit is contained in:
@@ -1294,7 +1294,7 @@ static NSString *userAgent = nil;
|
||||
{
|
||||
s = [self mimeTypeForExtension:[_name pathExtension]];
|
||||
if ([_name length] > 0)
|
||||
s = [s stringByAppendingFormat: @"; name=\"%@\"", _name];
|
||||
s = [s stringByAppendingFormat: @"; name=\"%@\"", [_name stringByReplacingOccurrencesOfString:@"\"" withString:@"\\\""]];
|
||||
}
|
||||
|
||||
return s;
|
||||
@@ -1320,7 +1320,7 @@ static NSString *userAgent = nil;
|
||||
cdtype = @"attachment";
|
||||
|
||||
cd = [cdtype stringByAppendingString: @"; filename=\""];
|
||||
cd = [cd stringByAppendingString: _name];
|
||||
cd = [cd stringByAppendingString: [_name stringByReplacingOccurrencesOfString:@"\"" withString:@"\\\""]];
|
||||
cd = [cd stringByAppendingString: @"\""];
|
||||
|
||||
// TODO: add size parameter (useful addition, RFC 2183)
|
||||
|
||||
@@ -790,7 +790,7 @@ static BOOL debugSoParts = NO;
|
||||
// See [UIxMailPartViewer _filenameForAttachment:]
|
||||
filenameURL = [[filename stringByReplacingString: @"/" withString: @"-"] stringByEscapingURL];
|
||||
currentFile = [NSDictionary dictionaryWithObjectsAndKeys:
|
||||
filename, @"filename",
|
||||
[filename stringByUnescapingURL], @"filename",
|
||||
[mimeType lowercaseString], @"mimetype",
|
||||
path, @"path",
|
||||
[part objectForKey: @"encoding"], @"encoding",
|
||||
|
||||
Reference in New Issue
Block a user