Allow direct change urls to end in '/'
While http://host/path/to/gerrit/4711 correctly forwarded to change 4711, http://host/path/to/gerrit/4711/ (trailing slash) resulted in a 404 Not Found. We now allow both variants to directly refer to a change. Change-Id: Ife4ef90b3c220c3d888840aff36d03dff27b9bd2
This commit is contained in:
parent
e9ca9a1837
commit
1854b15e29
@ -155,7 +155,11 @@ class UrlModule extends ServletModule {
|
||||
protected void doGet(final HttpServletRequest req,
|
||||
final HttpServletResponse rsp) throws IOException {
|
||||
try {
|
||||
Change.Id id = Change.Id.parse(req.getPathInfo());
|
||||
String idString = req.getPathInfo();
|
||||
if (idString.endsWith("/")) {
|
||||
idString = idString.substring(0, idString.length() - 1);
|
||||
}
|
||||
Change.Id id = Change.Id.parse(idString);
|
||||
toGerrit(PageLinks.toChange(id), req, rsp);
|
||||
} catch (IllegalArgumentException err) {
|
||||
rsp.sendError(HttpServletResponse.SC_NOT_FOUND);
|
||||
|
Loading…
Reference in New Issue
Block a user