mirror of
https://github.com/jupyterhub/jupyterhub.git
synced 2025-10-18 15:33:02 +00:00
Merge pull request #2648 from nicorikken/feature/debug-403-error
fix: spawn redirect for users whose names need escaping
This commit is contained in:
@@ -1357,7 +1357,9 @@ class UserUrlHandler(BaseHandler):
|
|||||||
return
|
return
|
||||||
|
|
||||||
pending_url = url_concat(
|
pending_url = url_concat(
|
||||||
url_path_join(self.hub.base_url, 'spawn-pending', user.name, server_name),
|
url_path_join(
|
||||||
|
self.hub.base_url, 'spawn-pending', user.escaped_name, server_name
|
||||||
|
),
|
||||||
{'next': self.request.uri},
|
{'next': self.request.uri},
|
||||||
)
|
)
|
||||||
if spawner.pending or spawner._failed:
|
if spawner.pending or spawner._failed:
|
||||||
@@ -1371,7 +1373,7 @@ class UserUrlHandler(BaseHandler):
|
|||||||
# without explicit user action
|
# without explicit user action
|
||||||
self.set_status(503)
|
self.set_status(503)
|
||||||
spawn_url = url_concat(
|
spawn_url = url_concat(
|
||||||
url_path_join(self.hub.base_url, "spawn", user.name, server_name),
|
url_path_join(self.hub.base_url, "spawn", user.escaped_name, server_name),
|
||||||
{"next": self.request.uri},
|
{"next": self.request.uri},
|
||||||
)
|
)
|
||||||
html = self.render_template(
|
html = self.render_template(
|
||||||
@@ -1459,7 +1461,8 @@ class UserRedirectHandler(BaseHandler):
|
|||||||
user_url = url_concat(user_url, parse_qsl(self.request.query))
|
user_url = url_concat(user_url, parse_qsl(self.request.query))
|
||||||
|
|
||||||
url = url_concat(
|
url = url_concat(
|
||||||
url_path_join(self.hub.base_url, "spawn", user.name), {"next": user_url}
|
url_path_join(self.hub.base_url, "spawn", user.escaped_name),
|
||||||
|
{"next": user_url},
|
||||||
)
|
)
|
||||||
|
|
||||||
self.redirect(url)
|
self.redirect(url)
|
||||||
|
@@ -62,9 +62,9 @@ class HomeHandler(BaseHandler):
|
|||||||
# to establish that this is an explicit spawn request rather
|
# to establish that this is an explicit spawn request rather
|
||||||
# than an implicit one, which can be caused by any link to `/user/:name(/:server_name)`
|
# than an implicit one, which can be caused by any link to `/user/:name(/:server_name)`
|
||||||
if user.active:
|
if user.active:
|
||||||
url = url_path_join(self.base_url, 'user', user.name)
|
url = url_path_join(self.base_url, 'user', user.escaped_name)
|
||||||
else:
|
else:
|
||||||
url = url_path_join(self.hub.base_url, 'spawn', user.name)
|
url = url_path_join(self.hub.base_url, 'spawn', user.escaped_name)
|
||||||
|
|
||||||
html = self.render_template(
|
html = self.render_template(
|
||||||
'home.html',
|
'home.html',
|
||||||
@@ -133,7 +133,7 @@ class SpawnHandler(BaseHandler):
|
|||||||
# which may get handled by the default server if they aren't ready yet
|
# which may get handled by the default server if they aren't ready yet
|
||||||
|
|
||||||
pending_url = url_path_join(
|
pending_url = url_path_join(
|
||||||
self.hub.base_url, "spawn-pending", user.name, server_name
|
self.hub.base_url, "spawn-pending", user.escaped_name, server_name
|
||||||
)
|
)
|
||||||
|
|
||||||
if self.get_argument('next', None):
|
if self.get_argument('next', None):
|
||||||
@@ -220,7 +220,7 @@ class SpawnHandler(BaseHandler):
|
|||||||
next_url = self.get_next_url(
|
next_url = self.get_next_url(
|
||||||
user,
|
user,
|
||||||
default=url_path_join(
|
default=url_path_join(
|
||||||
self.hub.base_url, "spawn-pending", user.name, server_name
|
self.hub.base_url, "spawn-pending", user.escaped_name, server_name
|
||||||
),
|
),
|
||||||
)
|
)
|
||||||
self.redirect(next_url)
|
self.redirect(next_url)
|
||||||
|
Reference in New Issue
Block a user