If removing the leading slash results in an empty string, return
with an HTTP 404 error before trying to use the RepositoryResolver.
Moving this into a loop ahead of the length check ensures there is
no empty string passed into the resolver.
Change-Id: I80e5b7cf25ae9f2164b5c396a29773e5c7d7286e
final HttpServletRequest req = (HttpServletRequest) request;
String name = req.getPathInfo();
+ while (name != null && 0 < name.length() && name.charAt(0) == '/')
+ name = name.substring(1);
if (name == null || name.length() == 0) {
((HttpServletResponse) rsp).sendError(SC_NOT_FOUND);
return;
}
- if (name.startsWith("/"))
- name = name.substring(1);
final Repository db;
try {