// strip leading /\r
path = path.substring(1);\r
}\r
+ if (path.charAt(path.length() - 1) == '/') {\r
+ // strip trailing slash\r
+ path = path.substring(0, path.length() - 1);\r
+ }\r
\r
// determine repository and resource from url\r
String repository = "";\r
response.getWriter().append("<thead><tr><th>path</th><th>mode</th><th>size</th></tr>");\r
response.getWriter().append("</thead>");\r
response.getWriter().append("<tbody>");\r
- String pattern = "<tr><td><a href=\"{0}\">{1}</a></td><td>{2}</td><td>{3}</td></tr>";\r
+ String pattern = "<tr><td><a href=\"{0}/{1}\">{1}</a></td><td>{2}</td><td>{3}</td></tr>";\r
final ByteFormat byteFormat = new ByteFormat();\r
List<PathModel> entries = JGitUtils.getFilesInPath(r, resource, commit);\r
if (!entries.isEmpty()) {\r
entries.add(0, new PathModel("..", resource + "/..", 0, FileMode.TREE.getBits(), null, null));\r
}\r
}\r
+\r
+ String basePath = request.getServletPath() + request.getPathInfo();\r
+ if (basePath.charAt(basePath.length() - 1) == '/') {\r
+ // strip trailing slash\r
+ basePath = basePath.substring(0, basePath.length() - 1);\r
+ }\r
for (PathModel entry : entries) {\r
- response.getWriter().append(MessageFormat.format(pattern, entry.path, entry.name, JGitUtils.getPermissionsFromMode(entry.mode), byteFormat.format(entry.size)));\r
+ response.getWriter().append(MessageFormat.format(pattern, basePath, entry.name,\r
+ JGitUtils.getPermissionsFromMode(entry.mode), byteFormat.format(entry.size)));\r
}\r
response.getWriter().append("</tbody>");\r
response.getWriter().append("</table>");\r