-
Bug
-
Resolution: Done
-
Major
-
1.4.0.Beta1
-
None
Undertow incorrectly resolves the MIME type for resources that are usually directories (i.e. they have no file extension) in ServerContextImpl:
@Override
public String getMimeType(final String file) {
if(file == null) {
return null;
}
String lower = file.toLowerCase(Locale.ENGLISH);
int pos = lower.lastIndexOf('.');
if (pos == -1) {
return deployment.getMimeExtensionMappings().get(lower);
}
return deployment.getMimeExtensionMappings().get(lower.substring(pos + 1));
}
Even for a directoty named "foo.css" I wouldn't expect the server to return such a MIME type. IMHO, the implemenation should check if the resource is a directory and return null in this case. It also makes sense to return null when file has no extension (instead of treating the file name as a one).