Merge master into rbac

This commit is contained in:
Min RK
2021-03-22 12:29:48 +01:00
76 changed files with 982 additions and 1310 deletions

View File

@@ -1604,7 +1604,6 @@ class UserUrlHandler(BaseHandler):
if self.subdomain_host:
target = user.host + target
referer = self.request.headers.get('Referer', '')
# record redirect count in query parameter
if redirects:
self.log.warning("Redirect loop detected on %s", self.request.uri)
@@ -1616,8 +1615,12 @@ class UserUrlHandler(BaseHandler):
query_parts['redirects'] = redirects + 1
url_parts = url_parts._replace(query=urlencode(query_parts, doseq=True))
target = urlunparse(url_parts)
elif '/user/{}'.format(user.name) in referer or not referer:
# add first counter only if it's a redirect from /user/:name -> /hub/user/:name
else:
# Start redirect counter.
# This should only occur for redirects from /user/:name -> /hub/user/:name
# when the corresponding server is already ready.
# We don't check this explicitly (direct visits to /hub/user are technically possible),
# but that's now the only normal way to get here.
target = url_concat(target, {'redirects': 1})
self.redirect(target)