From 0b1d0ffa9c2eb42f3c2fd3f22d167dc35638f28f Mon Sep 17 00:00:00 2001 From: Alex Guerra Date: Wed, 31 Jan 2024 07:26:54 -0600 Subject: [PATCH] Don't match on prefix alone --- src/common/isFileOnPath.ts | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/common/isFileOnPath.ts b/src/common/isFileOnPath.ts index 5a7b47f..5db446c 100644 --- a/src/common/isFileOnPath.ts +++ b/src/common/isFileOnPath.ts @@ -1,3 +1,4 @@ +import path from 'path'; import { getPosixFilePath } from './utils'; import { getAbsolutePath } from './getAbsolutePath'; import { getProjectPathFromArgs } from './utils'; @@ -19,5 +20,7 @@ export function isFileOnPath({ const absolutePathToStrictFiles = getAbsolutePath(projectPath, targetPath); - return getPosixFilePath(filePath).startsWith(getPosixFilePath(absolutePathToStrictFiles)); + return getPosixFilePath(filePath).startsWith( + getPosixFilePath(absolutePathToStrictFiles) + path.posix.sep, + ); }