summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDoug Kelly <doug.kelly@garmin.com>2015-04-09 14:22:32 -0500
committerDavid Pursehouse <david.pursehouse@sonymobile.com>2015-04-10 08:08:53 +0000
commit5fa42e8d93d65c1358d34b9a1b84004d34eaa92c (patch)
treec20f9e41ed5833a790aa97eb1cae520e938a488c
parentc7f58ccbd88c08f3e64c4753f5aa8e577288d204 (diff)
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
-rw-r--r--gerrit-httpd/src/main/java/com/google/gerrit/httpd/plugins/HttpPluginServlet.java3
1 files changed, 3 insertions, 0 deletions
diff --git a/gerrit-httpd/src/main/java/com/google/gerrit/httpd/plugins/HttpPluginServlet.java b/gerrit-httpd/src/main/java/com/google/gerrit/httpd/plugins/HttpPluginServlet.java
index dd4a899528..588663689a 100644
--- a/gerrit-httpd/src/main/java/com/google/gerrit/httpd/plugins/HttpPluginServlet.java
+++ b/gerrit-httpd/src/main/java/com/google/gerrit/httpd/plugins/HttpPluginServlet.java
@@ -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";
}
}