Skip to content

Commit

Permalink
use a better regex for isAbsolute check
Browse files Browse the repository at this point in the history
  • Loading branch information
SuperchupuDev committed Sep 30, 2024
1 parent d7438aa commit bbc37ec
Showing 1 changed file with 1 addition and 2 deletions.
3 changes: 1 addition & 2 deletions src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -38,8 +38,7 @@ function normalizePattern(
result += '/**';
}

// TODO: use a better regex for this
if (path.isAbsolute(result.replace(/\\/g, ''))) {
if (path.isAbsolute(result.replace(/\\(?=[()[\]{}!*+?@|])/g, ''))) {
result = posix.relative(cwd, result);
} else {
result = posix.normalize(result);
Expand Down

0 comments on commit bbc37ec

Please sign in to comment.