mirror of
https://github.com/swisspol/GCDWebServer.git
synced 2026-01-31 00:00:04 +08:00
GCDWebServerGetMimeTypeForExtension() always returns a MIME type
This commit is contained in:
@@ -102,7 +102,7 @@ NSString* GCDWebServerGetMimeTypeForExtension(NSString* extension) {
|
||||
}
|
||||
}
|
||||
}
|
||||
return mimeType;
|
||||
return mimeType ? mimeType : kGCDWebServerDefaultMimeType;
|
||||
}
|
||||
|
||||
NSString* GCDWebServerUnescapeURLString(NSString* string) {
|
||||
|
||||
@@ -306,12 +306,8 @@
|
||||
return nil; // TODO: Return 416 status code and "Content-Range: bytes */{file length}" header
|
||||
}
|
||||
}
|
||||
NSString* type = GCDWebServerGetMimeTypeForExtension([path pathExtension]);
|
||||
if (type == nil) {
|
||||
type = kGCDWebServerDefaultMimeType;
|
||||
}
|
||||
|
||||
if ((self = [super initWithContentType:type contentLength:(range.location != NSNotFound ? range.length : (NSUInteger)info.st_size)])) {
|
||||
if ((self = [super initWithContentType:GCDWebServerGetMimeTypeForExtension([path pathExtension]) contentLength:(range.location != NSNotFound ? range.length : (NSUInteger)info.st_size)])) {
|
||||
_path = [path copy];
|
||||
if (range.location != NSNotFound) {
|
||||
_offset = range.location;
|
||||
|
||||
Reference in New Issue
Block a user