Use encoded URL when redirecting user notebooks

Otherwise it breaks for usernames that have url unsafe
characters.
This commit is contained in:
YuviPanda
2016-03-08 17:08:23 -08:00
parent f7dab558e4
commit e0219d0363
3 changed files with 53 additions and 51 deletions

View File

@@ -8,7 +8,7 @@ from tornado import web, gen
from .. import orm
from ..utils import admin_only, url_path_join
from .base import BaseHandler
from .login import LoginHandler
from urllib.parse import quote
class RootHandler(BaseHandler):
@@ -75,7 +75,9 @@ class SpawnHandler(BaseHandler):
self.finish(self._render_form())
else:
# not running, no form. Trigger spawn.
url = url_path_join(self.base_url, 'user', user.name)
# Creating the URL manually since the server does not
# exist yet
url = url_path_join(self.base_url, 'user', quote(user.name))
self.redirect(url)
@web.authenticated

View File

@@ -10,7 +10,7 @@
{% endif %}
<a id="start" class="btn btn-lg btn-success"
{% if user.running %}
href="{{base_url}}user/{{user.name}}/"
href="{{ user.server.base_url }}"
{% else %}
href="{{base_url}}spawn"
{% endif %}