Commit 9ef7a971 authored by Felix Paul Kühne's avatar Felix Paul Kühne

wifi sharing: return correct content types for html, xml and css (closes #14083)

parent 8a75aae2
......@@ -325,29 +325,41 @@
NSString *deviceModel = [[UIDevice currentDevice] model];
NSDictionary *replacementDict;
HTTPDynamicFileResponse *fileResponse;
if ([relativePath isEqualToString:@"/libMediaVLC.xml"]) {
replacementDict = @{@"FILES" : [mediaInXml componentsJoinedByString:@" "],
@"NB_FILE" : [NSString stringWithFormat:@"%li", (unsigned long)mediaInXml.count],
@"LIB_TITLE" : [[UIDevice currentDevice] name]};
} else
fileResponse = [[HTTPDynamicFileResponse alloc] initWithFilePath:[self filePathForURI:path]
forConnection:self
separator:@"%%"
replacementDictionary:replacementDict];
fileResponse.contentType = @"application/xml";
} else {
replacementDict = @{@"FILES" : [mediaInHtml componentsJoinedByString:@" "],
@"WEBINTF_TITLE" : NSLocalizedString(@"WEBINTF_TITLE", nil),
@"WEBINTF_DROPFILES" : NSLocalizedString(@"WEBINTF_DROPFILES", nil),
@"WEBINTF_DROPFILES_LONG" : [NSString stringWithFormat:NSLocalizedString(@"WEBINTF_DROPFILES_LONG", nil), deviceModel],
@"WEBINTF_DOWNLOADFILES" : NSLocalizedString(@"WEBINTF_DOWNLOADFILES", nil),
@"WEBINTF_DOWNLOADFILES_LONG" : [NSString stringWithFormat: NSLocalizedString(@"WEBINTF_DOWNLOADFILES_LONG", nil), deviceModel]};
fileResponse = [[HTTPDynamicFileResponse alloc] initWithFilePath:[self filePathForURI:path]
forConnection:self
separator:@"%%"
replacementDictionary:replacementDict];
fileResponse.contentType = @"text/html";
}
return [[HTTPDynamicFileResponse alloc] initWithFilePath:[self filePathForURI:path]
forConnection:self
separator:@"%%"
replacementDictionary:replacementDict];
return fileResponse;
} else if ([relativePath isEqualToString:@"/style.css"]) {
NSDictionary *replacementDict = @{@"WEBINTF_TITLE" : NSLocalizedString(@"WEBINTF_TITLE", nil)};
return [[HTTPDynamicFileResponse alloc] initWithFilePath:[self filePathForURI:path]
forConnection:self
separator:@"%%"
replacementDictionary:replacementDict];
HTTPDynamicFileResponse *fileResponse = [[HTTPDynamicFileResponse alloc] initWithFilePath:[self filePathForURI:path]
forConnection:self
separator:@"%%"
replacementDictionary:replacementDict];
fileResponse.contentType = @"text/css";
return fileResponse;
}
return [super httpResponseForMethod:method URI:path];
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment