diff options
author | Florian Zschocke <f.zschocke+git@gmail.com> | 2020-11-07 19:56:51 +0100 |
---|---|---|
committer | Florian Zschocke <f.zschocke+git@gmail.com> | 2020-11-09 23:19:53 +0100 |
commit | 23943971846437c8bc24504d3bd4b681edea5433 (patch) | |
tree | 9229a1ceba224cb769c0b09b850557e7840769d4 /src/main | |
parent | dd56cd85715d0b8f6d9dfaca468f9589868cbded (diff) | |
download | gitblit-23943971846437c8bc24504d3bd4b681edea5433.tar.gz gitblit-23943971846437c8bc24504d3bd4b681edea5433.zip |
raw: Fix exceptions when no path info is given to raw servlet
Diffstat (limited to 'src/main')
-rw-r--r-- | src/main/java/com/gitblit/servlet/RawServlet.java | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/src/main/java/com/gitblit/servlet/RawServlet.java b/src/main/java/com/gitblit/servlet/RawServlet.java index 5fba78b5..211d847d 100644 --- a/src/main/java/com/gitblit/servlet/RawServlet.java +++ b/src/main/java/com/gitblit/servlet/RawServlet.java @@ -124,6 +124,7 @@ public class RawServlet extends HttpServlet { protected String getBranch(String repository, HttpServletRequest request) { String pi = request.getPathInfo(); + if (pi == null || pi.isEmpty() || pi.equals("/")) return ""; String branch = pi.substring(pi.indexOf(repository) + repository.length() + 1); int fs = branch.indexOf('/'); if (fs > -1) { @@ -135,7 +136,9 @@ public class RawServlet extends HttpServlet { protected String getPath(String repository, String branch, HttpServletRequest request) { String base = repository + "/" + branch; - String pi = request.getPathInfo().substring(1); + String pi = request.getPathInfo(); + if (pi == null || pi.isEmpty() || pi.equals("/")) return ""; + pi = pi.substring(1); if (pi.equals(base)) { return ""; } |