diff options
author | Florian Zschocke <2362065+flaix@users.noreply.github.com> | 2021-10-26 19:52:20 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-10-26 19:52:20 +0200 |
commit | 977e7240c7822772020bd36e92d357c03a59e77e (patch) | |
tree | c74ee7059c87e9f52bc3f4838c2221c50642b965 /src/main | |
parent | 583e15eb3f0f3a565b031dc554b420e28c50baae (diff) | |
parent | f1b150b8f3860e9116ecc7a5290e8296ca4fdcb5 (diff) | |
download | gitblit-977e7240c7822772020bd36e92d357c03a59e77e.tar.gz gitblit-977e7240c7822772020bd36e92d357c03a59e77e.zip |
Merge pull request #1383 from flaix/encode-raw-links
raw: URL encode the links to raw view of files
Diffstat (limited to 'src/main')
-rw-r--r-- | src/main/java/com/gitblit/servlet/RawServlet.java | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/src/main/java/com/gitblit/servlet/RawServlet.java b/src/main/java/com/gitblit/servlet/RawServlet.java index 9161eb6a..e2cd2881 100644 --- a/src/main/java/com/gitblit/servlet/RawServlet.java +++ b/src/main/java/com/gitblit/servlet/RawServlet.java @@ -36,6 +36,7 @@ import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; import org.apache.tika.Tika; +import org.apache.wicket.protocol.http.WicketURLEncoder; import org.eclipse.jgit.lib.FileMode; import org.eclipse.jgit.lib.MutableObjectId; import org.eclipse.jgit.lib.ObjectLoader; @@ -121,7 +122,8 @@ public class RawServlet extends HttpServlet { path = path.substring(1); } String encodedPath = path == null ? "" : path.replace('/', fsc); - return baseURL + Constants.RAW_PATH + repository + "/" + (branch == null ? "" : (branch + "/" + encodedPath)); + String fullPath = repository + "/" + (branch == null ? "" : (branch + "/" + encodedPath)); + return baseURL + Constants.RAW_PATH + WicketURLEncoder.FULL_PATH_INSTANCE.encode(fullPath); } |