diff --git a/packages/jupyter/src/hooks.ts b/packages/jupyter/src/hooks.ts index c67c16ba9..d91b9671c 100644 --- a/packages/jupyter/src/hooks.ts +++ b/packages/jupyter/src/hooks.ts @@ -168,8 +168,7 @@ export function useLaunchBinder() { if (userServerUrl && location) { // add the location to the url pathname const url = new URL(userServerUrl); - if (url.pathname.endsWith('/')) url.pathname = url.pathname.slice(0, -1); - url.pathname = `${url.pathname}/lab/tree${location}`; + url.pathname = `${url.pathname}lab/tree${location}`.replace(/\/+/g, '/'); userServerUrl = url.toString(); } return userServerUrl;