fix: prevent RangeError in GitIgnoreParser for root paths (#3417)

Co-authored-by: Jacob Richman <jacob314@gmail.com>
This commit is contained in:
osbornesec
2025-07-20 02:12:53 -05:00
committed by GitHub
parent 0a7e4397cb
commit 79d20b35dd
2 changed files with 21 additions and 1 deletions
+6 -1
View File
@@ -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;
}