Merge branch 'stable-2.14'

* stable-2.14:
  Fix StringIndexOutOfBoundsException on /register with URL prefix

Change-Id: I7c71c9f436ad776913f7bf1bc4d227e32723c854
This commit is contained in:
David Pursehouse 2017-07-11 21:29:49 +09:00
commit c358240c12

View File

@ -88,7 +88,8 @@ class UrlModule extends ServletModule {
serve("/starred").with(query("is:starred"));
serveRegex("^/settings/?$").with(screen(PageLinks.SETTINGS));
serveRegex("^/register(/.*)?$").with(registerScreen());
serveRegex("^/register$").with(registerScreen(false));
serveRegex("^/register/(.+)$").with(registerScreen(true));
serveRegex("^/([1-9][0-9]*)/?$").with(directChangeById());
serveRegex("^/p/(.*)$").with(queryProjectNew());
serveRegex("^/r/(.+)/?$").with(DirectChangeByCommit.class);
@ -245,14 +246,15 @@ class UrlModule extends ServletModule {
return srv;
}
private Key<HttpServlet> registerScreen() {
private Key<HttpServlet> registerScreen(final Boolean slash) {
return key(
new HttpServlet() {
private static final long serialVersionUID = 1L;
@Override
protected void doGet(HttpServletRequest req, HttpServletResponse rsp) throws IOException {
toGerrit("/register" + req.getPathInfo(), req, rsp);
String path = String.format("/register%s", slash ? req.getPathInfo() : "");
toGerrit(path, req, rsp);
}
});
}