From 86e45afb97c523055af1870b1f10175fb2ecc636 Mon Sep 17 00:00:00 2001 From: Daniel Marth Date: Thu, 5 Sep 2019 14:55:29 +0200 Subject: [PATCH 1/2] fixed file browser location in tree view and removed parameter from URL --- packages/application-extension/src/index.tsx | 20 +++++++++++++------- 1 file changed, 13 insertions(+), 7 deletions(-) diff --git a/packages/application-extension/src/index.tsx b/packages/application-extension/src/index.tsx index 051b16c16090..fde6086373b3 100644 --- a/packages/application-extension/src/index.tsx +++ b/packages/application-extension/src/index.tsx @@ -262,26 +262,32 @@ const tree: JupyterFrontEndPlugin = { const treeMatch = args.path.match(treePattern); const workspaceMatch = args.path.match(workspacePattern); const match = treeMatch || workspaceMatch; - let path = decodeURI(match[1]); + const path = decodeURI(match[1]); // const { page, workspaces } = info.urls; 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 = (workspaceMatch ? URLExt.join(paths.urls.workspaces, workspace) : paths.urls.app) + - args.search + + URLExt.objectToQueryString(query) + args.hash; // Remove the tree portion of the URL leaving the rest intact. router.navigate(url); - const query = URLExt.queryStringToObject(args.search); - if (query['file-browser-path']) { - path = query['file-browser-path']; - } - try { await commands.execute('filebrowser:open-path', { path }); + + if (fileBrowserPath) { + await commands.execute('filebrowser:open-path', { + path: fileBrowserPath + }); + } } catch (error) { console.warn('Tree routing failed.', error); } From d9483939b106225d3e71eda5b1dd4d61ff806576 Mon Sep 17 00:00:00 2001 From: "Afshin T. Darian" Date: Thu, 26 Sep 2019 16:12:11 +0100 Subject: [PATCH 2/2] Minor clarification of comments, removing old comment. --- packages/application-extension/src/index.tsx | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/packages/application-extension/src/index.tsx b/packages/application-extension/src/index.tsx index fde6086373b3..3f9d62f929b8 100644 --- a/packages/application-extension/src/index.tsx +++ b/packages/application-extension/src/index.tsx @@ -263,13 +263,14 @@ const tree: JupyterFrontEndPlugin = { const workspaceMatch = args.path.match(workspacePattern); const match = treeMatch || workspaceMatch; const path = decodeURI(match[1]); - // const { page, workspaces } = info.urls; const workspace = PathExt.basename(resolver.name); - let query = URLExt.queryStringToObject(args.search); - + const query = URLExt.queryStringToObject(args.search); const fileBrowserPath = query['file-browser-path']; + + // Remove the file browser path from the query string. delete query['file-browser-path']; + // Remove the tree portion of the URL. const url = (workspaceMatch ? URLExt.join(paths.urls.workspaces, workspace) @@ -277,7 +278,6 @@ const tree: JupyterFrontEndPlugin = { URLExt.objectToQueryString(query) + args.hash; - // Remove the tree portion of the URL leaving the rest intact. router.navigate(url); try {