Skip to content

Commit 0fc57bf

Browse files
authored
Merge pull request #13 from ian-r-rose/use_base_url
Use base_url so that the extension works in a JupyterHub setting.
2 parents 9eb7d43 + faffb57 commit 0fc57bf

File tree

1 file changed

+4
-3
lines changed

1 file changed

+4
-3
lines changed

jupyterlab_github/__init__.py

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,6 @@
1010
from notebook.utils import url_path_join, url_escape
1111
from notebook.base.handlers import APIHandler
1212

13-
path_regex = r'(?P<path>(?:(?:/[^/]+)+|/?))'
1413
link_regex = re.compile(r'<([^>]*)>;\s*rel="([\w]*)\"')
1514
GITHUB_API = 'https://api.github.com'
1615

@@ -100,5 +99,7 @@ def load_jupyter_server_extension(nb_server_app):
10099
nb_server_app (NotebookWebApplication): handle to the Notebook webserver instance.
101100
"""
102101
web_app = nb_server_app.web_app
103-
host_pattern = '.*$'
104-
web_app.add_handlers(host_pattern, [(r'/github%s' % path_regex, GitHubHandler)])
102+
base_url = web_app.settings['base_url']
103+
endpoint = url_path_join(base_url, 'github')
104+
handlers = [(endpoint + "(.*)", GitHubHandler)]
105+
web_app.add_handlers('.*$', handlers)

0 commit comments

Comments
 (0)