summaryrefslogtreecommitdiffstats
path: root/src/main
diff options
context:
space:
mode:
authorFlorian Zschocke <f.zschocke+git@gmail.com>2020-11-07 19:56:51 +0100
committerFlorian Zschocke <f.zschocke+git@gmail.com>2020-11-09 23:19:53 +0100
commit23943971846437c8bc24504d3bd4b681edea5433 (patch)
tree9229a1ceba224cb769c0b09b850557e7840769d4 /src/main
parentdd56cd85715d0b8f6d9dfaca468f9589868cbded (diff)
downloadgitblit-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.java5
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 "";
}