diff options
author | James Moger <james.moger@gitblit.com> | 2014-07-05 13:06:24 -0400 |
---|---|---|
committer | James Moger <james.moger@gitblit.com> | 2014-07-05 13:24:04 -0400 |
commit | f010ef67e4fece736f005050ef63ad5a62c68c8b (patch) | |
tree | ba8beed863f7096d5f92fe057c8768fd259e2e49 | |
parent | 9b575e8fac8d5e17e77cc284092abd856ddec8ac (diff) | |
download | gitblit-f010ef67e4fece736f005050ef63ad5a62c68c8b.tar.gz gitblit-f010ef67e4fece736f005050ef63ad5a62c68c8b.zip |
Fix raw servlet blob paths not respecting web.forwardSlashCharacter
-rw-r--r-- | src/main/java/com/gitblit/servlet/RawServlet.java | 18 |
1 files changed, 8 insertions, 10 deletions
diff --git a/src/main/java/com/gitblit/servlet/RawServlet.java b/src/main/java/com/gitblit/servlet/RawServlet.java index 15e036ea..ff3f7359 100644 --- a/src/main/java/com/gitblit/servlet/RawServlet.java +++ b/src/main/java/com/gitblit/servlet/RawServlet.java @@ -95,20 +95,17 @@ public class RawServlet extends DaggerServlet { baseURL = baseURL.substring(0, baseURL.length() - 1); } + char fsc = '!'; + char c = GitblitContext.getManager(IRuntimeManager.class).getSettings().getChar(Keys.web.forwardSlashCharacter, '/'); + if (c != '/') { + fsc = c; + } if (branch != null) { - char fsc = '!'; - char c = GitblitContext.getManager(IRuntimeManager.class).getSettings().getChar(Keys.web.forwardSlashCharacter, '/'); - if (c != '/') { - fsc = c; - } branch = branch.replace('/', fsc); } String encodedPath = path == null ? "" : path.replace(' ', '-'); - try { - encodedPath = URLEncoder.encode(encodedPath, "UTF-8"); - } catch (UnsupportedEncodingException e) { - } + encodedPath = encodedPath.replace('/', fsc); return baseURL + Constants.RAW_PATH + repository + "/" + (branch == null ? "" : (branch + "/" + (path == null ? "" : encodedPath))); } @@ -133,7 +130,8 @@ public class RawServlet extends DaggerServlet { if (path.endsWith("/")) { path = path.substring(0, path.length() - 1); } - return path; + char c = runtimeManager.getSettings().getChar(Keys.web.forwardSlashCharacter, '/'); + return path.replace('!', '/').replace(c, '/'); } protected boolean renderIndex() { |