summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDiogo Ferreira <diogo@underdev.org>2020-08-18 12:43:20 +0100
committerMarco Miller <marco.miller@ericsson.com>2021-05-12 09:15:11 -0400
commitb23b7e82936f37e76e352e70ea15b5afbd8e319e (patch)
tree0049ab186ad7ccec862cf9c60678cf16ecdfde5b
parentdf853d3e1e73db2f3f19562c0fe066b058bf2616 (diff)
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
-rw-r--r--java/com/google/gerrit/httpd/auth/openid/OpenIdServiceImpl.java5
1 files changed, 3 insertions, 2 deletions
diff --git a/java/com/google/gerrit/httpd/auth/openid/OpenIdServiceImpl.java b/java/com/google/gerrit/httpd/auth/openid/OpenIdServiceImpl.java
index be975c5e99..b685011744 100644
--- a/java/com/google/gerrit/httpd/auth/openid/OpenIdServiceImpl.java
+++ b/java/com/google/gerrit/httpd/auth/openid/OpenIdServiceImpl.java
@@ -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);