mirror of
https://github.com/gnustep/libs-base.git
synced 2025-04-22 16:33:29 +00:00
Improve -contentFile to check the content-type header before content-disposition
This commit is contained in:
parent
1f2b03e84d
commit
48c270b9ca
1 changed files with 10 additions and 4 deletions
|
@ -5724,14 +5724,20 @@ appendString(NSMutableData *m, NSUInteger offset, NSUInteger fold,
|
|||
return nil;
|
||||
}
|
||||
|
||||
/**
|
||||
* Convenience method to fetch the content file name from the header.
|
||||
/** Convenience method to fetch the content file name from the content-type
|
||||
* or content-disposition header.
|
||||
*/
|
||||
- (NSString*) contentFile
|
||||
{
|
||||
GSMimeHeader *hdr = [self headerNamed: @"content-disposition"];
|
||||
GSMimeHeader *hdr = [self headerNamed: CteContentType];
|
||||
NSString *str = [hdr parameterForKey: @"name"];
|
||||
|
||||
return [hdr parameterForKey: @"filename"];
|
||||
if (nil == str)
|
||||
{
|
||||
hdr = [self headerNamed: @"content-disposition"];
|
||||
str = [hdr parameterForKey: @"filename"];
|
||||
}
|
||||
return str;
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
Loading…
Reference in a new issue