fix: prevent EISDIR crash when customIgnoreFilePaths contains directories (#19868) (#19898)

Co-authored-by: Tommaso Sciortino <sciortino@gmail.com>
This commit is contained in:
Suhaan Raqeeb Khavas
2026-05-12 02:16:08 +05:30
committed by GitHub
parent c0d5ab1f1e
commit 8e58df72c6
4 changed files with 53 additions and 3 deletions
+3 -1
View File
@@ -19,8 +19,10 @@ export function loadIgnoreRules(
const ignoreFiles = service.getAllIgnoreFilePaths();
for (const filePath of ignoreFiles) {
if (fs.existsSync(filePath)) {
try {
ignorer.add(fs.readFileSync(filePath, 'utf8'));
} catch {
// Skip files that can't be read (e.g. directories, permission errors)
}
}
+4 -1
View File
@@ -105,7 +105,10 @@ export class IgnoreFileParser implements IgnoreFileFilter {
.slice()
.reverse()
.map((fileName) => path.join(this.projectRoot, fileName))
.filter((filePath) => fs.existsSync(filePath));
.filter(
(filePath) =>
fs.statSync(filePath, { throwIfNoEntry: false })?.isFile() ?? false,
);
}
/**