summaryrefslogtreecommitdiff
path: root/packages/core/src/utils/gitIgnoreParser.ts
diff options
context:
space:
mode:
authorosbornesec <[email protected]>2025-07-20 02:12:53 -0500
committerGitHub <[email protected]>2025-07-20 07:12:53 +0000
commitc0bfa388c571342265915f8de888a43190c82759 (patch)
treeef3f069a4876a17f946a023bbf1356042668c549 /packages/core/src/utils/gitIgnoreParser.ts
parentfe00686c58421ae7d9a60bddf38deda35591709b (diff)
fix: prevent RangeError in GitIgnoreParser for root paths (#3417)
Co-authored-by: Jacob Richman <[email protected]>
Diffstat (limited to 'packages/core/src/utils/gitIgnoreParser.ts')
-rw-r--r--packages/core/src/utils/gitIgnoreParser.ts7
1 files changed, 6 insertions, 1 deletions
diff --git a/packages/core/src/utils/gitIgnoreParser.ts b/packages/core/src/utils/gitIgnoreParser.ts
index 37041272..50018bb7 100644
--- a/packages/core/src/utils/gitIgnoreParser.ts
+++ b/packages/core/src/utils/gitIgnoreParser.ts
@@ -61,7 +61,12 @@ export class GitIgnoreParser implements GitIgnoreFilter {
? path.relative(this.projectRoot, filePath)
: filePath;
- if (relativePath === '' || relativePath.startsWith('..')) {
+ if (
+ relativePath === '' ||
+ relativePath.startsWith('..') ||
+ relativePath === '/' ||
+ relativePath.startsWith('/')
+ ) {
return false;
}