Skip to content

Commit

Permalink
Fix notebook URL opened in browser when redirect file not used
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
randomir committed Sep 18, 2023
1 parent 1cb4116 commit 00447c1
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions jupyter_server/serverapp.py
Original file line number Diff line number Diff line change
Expand Up @@ -2777,6 +2777,10 @@ def _prepare_browser_open(self):
if self.identity_provider.token:
uri = url_concat(uri, {"token": self.identity_provider.token})

if self.file_to_run:
file_to_run_relpath = self._resolve_file_to_run_and_root_dir()
uri = url_escape(url_path_join(uri, *file_to_run_relpath.split(os.sep)))

if self.file_to_run: # noqa
# Create a separate, temporary open-browser-file
# pointing at a specific file.
Expand Down

0 comments on commit 00447c1

Please sign in to comment.