From bbc37ec622cc5323d9fb8c18e24f24eb44133414 Mon Sep 17 00:00:00 2001 From: Superchupu <53496941+SuperchupuDev@users.noreply.github.com> Date: Mon, 30 Sep 2024 10:53:18 +0200 Subject: [PATCH] use a better regex for `isAbsolute` check --- src/index.ts | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/src/index.ts b/src/index.ts index 4d3cf54..1b3ba74 100644 --- a/src/index.ts +++ b/src/index.ts @@ -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);