diff --git a/src/Skipper/RealpathMatcher.php b/src/Skipper/RealpathMatcher.php index f912000c48..6a947fd26b 100644 --- a/src/Skipper/RealpathMatcher.php +++ b/src/Skipper/RealpathMatcher.php @@ -23,16 +23,13 @@ public function match(string $matchingPath, string $filePath): bool $normalizedMatchingPath = PathNormalizer::normalize($realPathMatchingPath); $normalizedFilePath = PathNormalizer::normalize($realpathFilePath); - // skip define direct path - if (is_file($normalizedMatchingPath)) { - return $normalizedMatchingPath === $normalizedFilePath; + // skip define direct path exactly equal + if ($normalizedMatchingPath === $normalizedFilePath) { + return true; } // ensure add / suffix to ensure no same prefix directory - if (is_dir($normalizedMatchingPath)) { - $normalizedMatchingPath = rtrim($normalizedMatchingPath, '/') . '/'; - } - - return str_starts_with($normalizedFilePath, $normalizedMatchingPath); + $suffixedMatchingPath = rtrim($normalizedMatchingPath, '/') . '/'; + return str_starts_with($normalizedFilePath, $suffixedMatchingPath); } }