Skip to content

Commit

Permalink
Updated logic for quick Regex match
Browse files Browse the repository at this point in the history
  • Loading branch information
itsmevichu committed Feb 25, 2024
1 parent d0f67f5 commit b9a0f13
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions packages/application-extension/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -200,7 +200,8 @@ const opener: JupyterFrontEndPlugin<void> = {
): void => {
const { commands, docRegistry } = app;

const ignoredPattern = new RegExp('/tree(.*)');
const ignoredPattern = new RegExp('/tree/(.*)');
const pathSegmentPattern = new RegExp('\\bnotebooks\\b|\\bedit\\b');
const command = 'router:tree';
commands.addCommand(command, {
execute: (args: any) => {
Expand All @@ -212,7 +213,7 @@ const opener: JupyterFrontEndPlugin<void> = {
return;
}

const pathSegments: string[] = parsed.path.split(TREE_PATTERN);
const pathSegments: string[] = parsed.path.split(pathSegmentPattern);
if (pathSegments.length > 1 && pathSegments[0].match(ignoredPattern)) {
return;
}
Expand Down

0 comments on commit b9a0f13

Please sign in to comment.