Prevent wrong content type for CSS files

The mime-util library contains two content type mappings for .css
files: application/x-pointplus and text/css.  Unfortunately, using
the wrong one will result in most browsers discarding the file as
a CSS file.  Ensure we only use the correct type for CSS files.

This happens because MimeUtilFileTypeRegistry attempts to get all
MIME types from mime-util and then sort the result based on the
specificity of each type.  Since both types have no magic string,
only the ExtensionMimeDetector matches.

Change-Id: Idfe88dc823f191d9c9e0b9c9da3b5d2ec471f9db
This commit is contained in:
Doug Kelly
2015-04-09 14:22:32 -05:00
committed by David Pursehouse
parent c7f58ccbd8
commit 5fa42e8d93

View File

@@ -580,6 +580,9 @@ class HttpPluginServlet extends HttpServlet
if ("application/octet-stream".equals(contentType)
&& entry.getName().endsWith(".js")) {
contentType = "application/javascript";
} else if ("application/x-pointplus".equals(contentType)
&& entry.getName().endsWith(".css")) {
contentType = "text/css";
}
}