mirror of
https://github.com/inverse-inc/sogo.git
synced 2026-05-22 03:45:25 +00:00
;
Monotone-Parent: d777e4fa4da8204aa4e7f4b49a17a97670c98df6 Monotone-Revision: fb236ef24d48d36061d3027ebfc80c62e1ade879 Monotone-Author: wsourdeau@inverse.ca Monotone-Date: 2008-03-28T18:16:55 Monotone-Branch: ca.inverse.sogo
This commit is contained in:
@@ -713,21 +713,25 @@ static BOOL showTextAttachmentsInline = NO;
|
||||
return ma;
|
||||
}
|
||||
|
||||
- (BOOL) isValidAttachmentName: (NSString *) _name
|
||||
- (BOOL) isValidAttachmentName: (NSString *) filename
|
||||
{
|
||||
static NSString *sescape[] = { @"/", @"..", @"~", @"\"", @"'", nil };
|
||||
unsigned i;
|
||||
unsigned int i;
|
||||
NSRange r;
|
||||
BOOL result;
|
||||
|
||||
if (![_name isNotNull]) return NO;
|
||||
if ([_name length] == 0) return NO;
|
||||
if ([_name hasPrefix: @"."]) return NO;
|
||||
|
||||
for (i = 0; sescape[i] != nil; i++) {
|
||||
r = [_name rangeOfString:sescape[i]];
|
||||
if (r.length > 0) return NO;
|
||||
}
|
||||
return YES;
|
||||
result = ([filename length] && ![filename hasPrefix: @"."]);
|
||||
i = 0;
|
||||
while (result && sescape[i])
|
||||
{
|
||||
r = [filename rangeOfString: sescape[i]];
|
||||
if (r.length > 0)
|
||||
result = NO;
|
||||
else
|
||||
i++;
|
||||
}
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
- (NSString *) pathToAttachmentWithName: (NSString *) _name
|
||||
|
||||
@@ -337,15 +337,11 @@ static NSArray *infoKeys = nil;
|
||||
|
||||
co = [self clientObject];
|
||||
allKeys = [[request formValueKeys] objectEnumerator];
|
||||
key = [allKeys nextObject];
|
||||
while (key && success)
|
||||
{
|
||||
if ([key hasPrefix: @"attachment"])
|
||||
success
|
||||
= (![co saveAttachment: (NSData *) [request formValueForKey: key]
|
||||
withMetadata: [filenames objectForKey: key]]);
|
||||
key = [allKeys nextObject];
|
||||
}
|
||||
while ((key = [allKeys nextObject]) && success)
|
||||
if ([key hasPrefix: @"attachment"])
|
||||
success
|
||||
= (![co saveAttachment: (NSData *) [request formValueForKey: key]
|
||||
withMetadata: [filenames objectForKey: key]]);
|
||||
|
||||
return success;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user