diff --git a/nbclassic/notebook/handlers.py b/nbclassic/notebook/handlers.py index 5b0eff1bb..7c61435ae 100644 --- a/nbclassic/notebook/handlers.py +++ b/nbclassic/notebook/handlers.py @@ -16,7 +16,7 @@ ExtensionHandlerMixin, ExtensionHandlerJinjaMixin ) -from jupyter_server.base.handlers import path_regex, FilesRedirectHandler +from jupyter_server.base.handlers import path_regex, get_service_name, FilesRedirectHandler from jupyter_server.utils import ( url_path_join, url_escape, @@ -97,7 +97,11 @@ def get(self, path): raise if model['type'] != 'notebook': # not a notebook, redirect to files - yield FilesRedirectHandler.redirect_to_files(self, path) + url = url_path_join( + self.base_url, get_service_name(model['name']), url_escape(path), + ) + self.log.debug("Redirecting %s to %s", self.request.path, url) + self.redirect(url) name = path.rsplit('/', 1)[-1] self.write(self.render_template('notebook.html', notebook_path=path,