diff options
author | James Moger <james.moger@gitblit.com> | 2014-11-19 11:17:59 -0500 |
---|---|---|
committer | James Moger <james.moger@gitblit.com> | 2014-11-19 11:17:59 -0500 |
commit | c8b728c5887c027eb3bd1db802cdc938d678cb3e (patch) | |
tree | 348057bbf81e17f9acf2ee0b31c73787edd0fd31 | |
parent | 57f05709b0b7072b4d9fb1a355d87dff7c7e3665 (diff) | |
download | gitblit-c8b728c5887c027eb3bd1db802cdc938d678cb3e.tar.gz gitblit-c8b728c5887c027eb3bd1db802cdc938d678cb3e.zip |
Add support for image/svg+xml content type to raw servlet
-rw-r--r-- | src/main/distrib/data/defaults.properties | 2 | ||||
-rw-r--r-- | src/main/java/com/gitblit/servlet/RawServlet.java | 13 |
2 files changed, 11 insertions, 4 deletions
diff --git a/src/main/distrib/data/defaults.properties b/src/main/distrib/data/defaults.properties index dae2e619..14b3f63e 100644 --- a/src/main/distrib/data/defaults.properties +++ b/src/main/distrib/data/defaults.properties @@ -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 # diff --git a/src/main/java/com/gitblit/servlet/RawServlet.java b/src/main/java/com/gitblit/servlet/RawServlet.java index 682e555a..dac38f36 100644 --- a/src/main/java/com/gitblit/servlet/RawServlet.java +++ b/src/main/java/com/gitblit/servlet/RawServlet.java @@ -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. * |