浏览代码

fixed file browser location in tree view and removed parameter from URL

Daniel Marth 5 年之前
父节点
当前提交
86e45afb97
共有 1 个文件被更改,包括 13 次插入7 次删除
  1. 13 7
      packages/application-extension/src/index.tsx

+ 13 - 7
packages/application-extension/src/index.tsx

@@ -262,26 +262,32 @@ const tree: JupyterFrontEndPlugin<void> = {
         const treeMatch = args.path.match(treePattern);
         const treeMatch = args.path.match(treePattern);
         const workspaceMatch = args.path.match(workspacePattern);
         const workspaceMatch = args.path.match(workspacePattern);
         const match = treeMatch || workspaceMatch;
         const match = treeMatch || workspaceMatch;
-        let path = decodeURI(match[1]);
+        const path = decodeURI(match[1]);
         // const { page, workspaces } = info.urls;
         // const { page, workspaces } = info.urls;
         const workspace = PathExt.basename(resolver.name);
         const workspace = PathExt.basename(resolver.name);
+        let query = URLExt.queryStringToObject(args.search);
+
+        const fileBrowserPath = query['file-browser-path'];
+        delete query['file-browser-path'];
+
         const url =
         const url =
           (workspaceMatch
           (workspaceMatch
             ? URLExt.join(paths.urls.workspaces, workspace)
             ? URLExt.join(paths.urls.workspaces, workspace)
             : paths.urls.app) +
             : paths.urls.app) +
-          args.search +
+          URLExt.objectToQueryString(query) +
           args.hash;
           args.hash;
 
 
         // Remove the tree portion of the URL leaving the rest intact.
         // Remove the tree portion of the URL leaving the rest intact.
         router.navigate(url);
         router.navigate(url);
 
 
-        const query = URLExt.queryStringToObject(args.search);
-        if (query['file-browser-path']) {
-          path = query['file-browser-path'];
-        }
-
         try {
         try {
           await commands.execute('filebrowser:open-path', { path });
           await commands.execute('filebrowser:open-path', { path });
+
+          if (fileBrowserPath) {
+            await commands.execute('filebrowser:open-path', {
+              path: fileBrowserPath
+            });
+          }
         } catch (error) {
         } catch (error) {
           console.warn('Tree routing failed.', error);
           console.warn('Tree routing failed.', error);
         }
         }