@@ -173,17 +173,17 @@ def get_uid_str(uid):
173173 if (!proxy || hasHostName) {
174174 return config;
175175 }
176- const { origin, pathname } = new URL(window.location.href);
176+ let { origin, pathname } = new URL(window.location.href);
177177 const isInWorkspaces = origin.startsWith(WORKSPACES_URL_KEYWORD);
178-
179178 const jupyterLabConfigEl = document.getElementById('jupyter-config-data');
180179
181180 let baseUrl;
182181 if (isInWorkspaces) {
183182 const pathSegments = pathname.split('/');
184183 const passthroughIndex = pathSegments.indexOf('passthrough');
185184 if (passthroughIndex !== -1) {
186- baseUrl = pathSegments.slice(0, passthroughIndex + 2).join('/');
185+ baseUrl = pathSegments.slice(0, passthroughIndex + 3).join('/');
186+ baseUrl += '/';
187187 }
188188 } else if (jupyterLabConfigEl) {
189189 // This is jupyter lab
@@ -196,17 +196,10 @@ def get_uid_str(uid):
196196 ...config,
197197 datasets: config.datasets.map(d => ({
198198 ...d,
199- files: d.files.map(f => {
200- if (isInWorkspaces && f.url.startsWith('proxy')) {
201- // When the user is in workspaces, we do not use jupyter_server_proxy.
202- // Instead, the workspaces infrastructure has its own "passthrough" functionality.
203- f.url = f.url.replace('proxy', '');
204- }
205- return {
206- ...f,
207- url: `${origin}${baseUrl}${f.url}`,
208- };
209- }),
199+ files: d.files.map(f => ({
200+ ...f,
201+ url: `${origin}${baseUrl}${f.url}`,
202+ })),
210203 })),
211204 };
212205}
0 commit comments