Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion packages/application-extension/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ import { Menu, Widget } from '@lumino/widgets';
/**
* A regular expression to match path to notebooks and documents
*/
const TREE_PATTERN = new RegExp('/(notebooks|edit)/(.*)');
const TREE_PATTERN = new RegExp('^/(notebooks|edit)/(.*)$');

/**
* A regular expression to suppress the file extension from display for .ipynb files.
Expand Down
22 changes: 22 additions & 0 deletions ui-tests/test/tree.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,28 @@ test('Should redirect from notebooks route to tree route for directories', async
expect(url.pathname).toEqual(`/tree/${dir}`);
});

test('should not show a file load error when path contains notebooks', async ({
page,
tmpPath,
}) => {
const nestedPath = `${tmpPath}/test/notebooks/test`;
await page.contents.createDirectory(`${tmpPath}/test`);
await page.contents.createDirectory(`${tmpPath}/test/notebooks`);
await page.contents.createDirectory(nestedPath);

await page.goto(`tree/${nestedPath}`);
await page.waitForSelector('.jp-FileBrowser-crumbs >> text=/test/');
await page.waitForSelector('.jp-FileBrowser-crumbs >> text=/notebooks/');
expect(new URL(page.url()).pathname).toEqual(`/tree/${nestedPath}`);

await page.reload({ waitUntil: 'networkidle' });
await page.waitForSelector('.jp-FileBrowser-crumbs >> text=/test/');
await page.waitForSelector('.jp-FileBrowser-crumbs >> text=/notebooks/');
expect(new URL(page.url()).pathname).toEqual(`/tree/${nestedPath}`);

await expect(page.locator('text=File Load Error')).toHaveCount(0);
});

test('Should activate file browser tab', async ({ page, tmpPath }) => {
await page.goto(`tree/${tmpPath}`);
await page.locator('.jp-TreePanel >> text="Running"').click();
Expand Down
Loading