Fix registration redirect on OpenID

For polygerrit, the default URL for anonymous is:

http(s)://host/q/status:open+-is:wip

When authenticating via OpenID, a new redirect URL is constructed and
the following is produced:

http(s)://host/#registerq/status:open+-is:wip

This is obviously wrong and causes a 404. Instead what we want is:

http(s)://host/#register/q/status:open+-is:wip

This patch simply adds that slash.

Change-Id: I06cf37df2771223b02af984f45d961de3cf19a92
This commit is contained in:
Diogo Ferreira
2020-08-18 12:43:20 +01:00
committed by Marco Miller
parent df853d3e1e
commit b23b7e8293

View File

@@ -477,8 +477,9 @@ class OpenIdServiceImpl {
final StringBuilder rdr = new StringBuilder();
rdr.append(urlProvider.get(req));
String nextToken = Url.decode(token);
if (isNew && !token.startsWith(PageLinks.REGISTER + "/")) {
rdr.append('#' + PageLinks.REGISTER);
String registerUri = PageLinks.REGISTER + "/";
if (isNew && !token.startsWith(registerUri)) {
rdr.append('#' + registerUri);
if (nextToken.startsWith("#")) {
// Need to strip the leading # off the token to fix registration page redirect
nextToken = nextToken.substring(1);