From 5fa42e8d93d65c1358d34b9a1b84004d34eaa92c Mon Sep 17 00:00:00 2001 From: Doug Kelly Date: Thu, 9 Apr 2015 14:22:32 -0500 Subject: [PATCH] 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 --- .../com/google/gerrit/httpd/plugins/HttpPluginServlet.java | 3 +++ 1 file changed, 3 insertions(+) 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"; } }