From 9ceddb66153d78fbbc13fc6b1ab24714080ed17a Mon Sep 17 00:00:00 2001 From: James Moger Date: Sun, 26 Oct 2014 10:16:49 -0400 Subject: [PATCH] Fix raw servlet trashing paths with spaces --- releases.moxie | 2 ++ src/main/java/com/gitblit/servlet/RawServlet.java | 5 ++--- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/releases.moxie b/releases.moxie index 222db662..446d1619 100644 --- a/releases.moxie +++ b/releases.moxie @@ -11,11 +11,13 @@ r26: { security: ~ fixes: - Fix French translation (pr-224, ticket-210) + - Fix raw servlet trashing paths with spaces (ticket-211) changes: ~ additions: ~ dependencyChanges: ~ contributors: - Pierre Templier + - Barry Roberts } # diff --git a/src/main/java/com/gitblit/servlet/RawServlet.java b/src/main/java/com/gitblit/servlet/RawServlet.java index ac77646f..ca41d0ab 100644 --- a/src/main/java/com/gitblit/servlet/RawServlet.java +++ b/src/main/java/com/gitblit/servlet/RawServlet.java @@ -104,9 +104,8 @@ public class RawServlet extends DaggerServlet { branch = Repository.shortenRefName(branch).replace('/', fsc); } - String encodedPath = path == null ? "" : path.replace(' ', '-'); - encodedPath = encodedPath.replace('/', fsc); - return baseURL + Constants.RAW_PATH + repository + "/" + (branch == null ? "" : (branch + "/" + (path == null ? "" : encodedPath))); + String encodedPath = path == null ? "" : path.replace('/', fsc); + return baseURL + Constants.RAW_PATH + repository + "/" + (branch == null ? "" : (branch + "/" + encodedPath)); } protected String getBranch(String repository, HttpServletRequest request) { -- 2.39.5