]> source.dussan.org Git - gitblit.git/commitdiff
Add support for image/svg+xml content type to raw servlet 23/223/1
authorJames Moger <james.moger@gitblit.com>
Wed, 19 Nov 2014 16:17:59 +0000 (11:17 -0500)
committerJames Moger <james.moger@gitblit.com>
Wed, 19 Nov 2014 16:17:59 +0000 (11:17 -0500)
src/main/distrib/data/defaults.properties
src/main/java/com/gitblit/servlet/RawServlet.java

index dae2e61962836674eeec1aa7f20b3b11b8a52f72..14b3f63e881a567fae17119b756dfb72c33faa05 100644 (file)
@@ -1324,7 +1324,7 @@ web.tracwikiExtensions = tracwiki
 #
 # SPACE-DELIMITED
 # SINCE 0.5.0
-web.imageExtensions = bmp jpg jpeg gif png ico 
+web.imageExtensions = bmp ico gif jpg jpeg png svg
 
 # Registered extensions for binary blobs
 #
index 682e555a6de2aec703ab79ac6a8e095bfe6cae40..dac38f36d16a9c815ac3cf1e6dfd8f7856d3d5d2 100644 (file)
@@ -28,8 +28,6 @@ import java.util.List;
 import java.util.Map;
 import java.util.TreeMap;
 
-import com.google.inject.Inject;
-import com.google.inject.Singleton;
 import javax.servlet.ServletContext;
 import javax.servlet.ServletException;
 import javax.servlet.http.HttpServlet;
@@ -58,6 +56,8 @@ import com.gitblit.utils.ByteFormat;
 import com.gitblit.utils.JGitUtils;
 import com.gitblit.utils.MarkdownUtils;
 import com.gitblit.utils.StringUtils;
+import com.google.inject.Inject;
+import com.google.inject.Singleton;
 
 /**
  * Serves the content of a branch.
@@ -248,7 +248,7 @@ public class RawServlet extends HttpServlet {
                                                }
                                        }
 
-                                       if (isTextType(contentType)) {
+                                       if (isTextType(contentType) || isTextDataType(contentType)) {
 
                                                // load, interpret, and serve text content as UTF-8
                                                String [] encodings = runtimeManager.getSettings().getStrings(Keys.web.blobEncodings).toArray(new String[0]);
@@ -382,6 +382,13 @@ public class RawServlet extends HttpServlet {
                return false;
        }
 
+       protected boolean isTextDataType(String contentType) {
+               if ("image/svg+xml".equals(contentType)) {
+                       return true;
+               }
+               return false;
+       }
+
        /**
         * Override all text types to be plain text.
         *