mirror of
https://github.com/inverse-inc/sogo.git
synced 2026-07-12 20:05:08 +00:00
Improve handling of attachments names with quotes
Partially resolves #2272
This commit is contained in:
@@ -1304,7 +1304,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;
|
||||
@@ -1330,7 +1330,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)
|
||||
|
||||
@@ -526,10 +526,9 @@ static NSArray *infoKeys = nil;
|
||||
if (!attachedFiles)
|
||||
attachedFiles = [NSMutableArray new];
|
||||
|
||||
newFilename = filename;
|
||||
|
||||
baseFilename = [filename stringByDeletingPathExtension];
|
||||
extension = [filename pathExtension];
|
||||
newFilename = [filename stringByReplacingOccurrencesOfString:@"\\\"" withString:@"\""]; /* to real filename */
|
||||
baseFilename = [newFilename stringByDeletingPathExtension];
|
||||
extension = [newFilename pathExtension];
|
||||
variation = 0;
|
||||
while ([attachedFiles containsObject: newFilename])
|
||||
{
|
||||
|
||||
@@ -118,7 +118,7 @@
|
||||
<li class="attachButton"><span class="button fileinput-button"><span><img rsrc:src="title_attachment_14x14.png" /> <var:string label:value="Attach"/></span><input id="fileUpload" type="file" name="attachments" tabindex="-1" multiple="multiple"/></span></li>
|
||||
<var:foreach list="attachmentAttrs" item="attachment"
|
||||
><li class="progressDone" var:data-filename="attachment.filename">
|
||||
<i class="icon-attachment"><!-- icon --></i><a var:href="attachment.url" target="_new"><var:string value="attachment.filename"/></a><span class="muted">(<var:string value="attachment.size" formatter="sizeFormatter" />)</span>
|
||||
<i class="icon-attachment"><!-- icon --></i><a var:href="attachment.url" target="_new"><var:string value="attachment.filename" const:escapeHTML="YES"/></a><span class="muted">(<var:string value="attachment.size" formatter="sizeFormatter"/>)</span>
|
||||
</li></var:foreach>
|
||||
</ul>
|
||||
</div>
|
||||
|
||||
Reference in New Issue
Block a user