Skip to content

Commit 3083173

Browse files
committed
Fix notebook URL opened in browser when redirect file not used
With `notebook~=7.0` ServerApp is responsible for launching browser, not NotebookApp anymore. In `notebook~=6.0`, `launch_browser` will append notebook path for opening in browser even when `use_redirect_file` is set to `false` - unlike ServerApp, ever since 60c66b6.
1 parent 46e685b commit 3083173

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

jupyter_server/serverapp.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2781,6 +2781,10 @@ def _prepare_browser_open(self):
27812781
if self.identity_provider.token:
27822782
uri = url_concat(uri, {"token": self.identity_provider.token})
27832783

2784+
if self.file_to_run:
2785+
file_to_run_relpath = self._resolve_file_to_run_and_root_dir()
2786+
uri = url_escape(url_path_join(uri, *file_to_run_relpath.split(os.sep)))
2787+
27842788
if self.file_to_run: # noqa
27852789
# Create a separate, temporary open-browser-file
27862790
# pointing at a specific file.

0 commit comments

Comments
 (0)