Skip to content

Commit

Permalink
Merge pull request #950 from saper/searchlast
Browse files Browse the repository at this point in the history
Match longest repository path towards the shortest
  • Loading branch information
gitblit committed Nov 18, 2015
2 parents 27a0998 + c4e5664 commit a5cf407
Showing 1 changed file with 6 additions and 15 deletions.
21 changes: 6 additions & 15 deletions src/main/java/com/gitblit/servlet/RawServlet.java
Expand Up @@ -161,23 +161,14 @@ private void processRequest(HttpServletRequest request, HttpServletResponse resp
}

// determine repository and resource from url
String repository = "";
String repository = path;
Repository r = null;
int offset = 0;
while (r == null) {
int slash = path.indexOf('/', offset);
if (slash == -1) {
repository = path;
} else {
repository = path.substring(0, slash);
}
offset = ( slash + 1 );
int terminator = repository.length();
do {
repository = repository.substring(0, terminator);
r = repositoryManager.getRepository(repository, false);
if (repository.equals(path)) {
// either only repository in url or no repository found
break;
}
}
terminator = repository.lastIndexOf('/');
} while (r == null && terminator > -1 );

ServletContext context = request.getSession().getServletContext();

Expand Down

0 comments on commit a5cf407

Please sign in to comment.