Improve -contentFile to check the content-type header before content-disposition

This commit is contained in:
Richard Frith-Macdonald 2020-08-08 19:30:18 +01:00
parent 1f2b03e84d
commit 48c270b9ca

View file

@ -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;
}
/**