Merge pull request #253 from jimmynail/fix/skip-unreadable-files
fix: skip unreadable files during indexing instead of crashing
This commit is contained in:
commit
271feb7791
10
src/qmd.ts
10
src/qmd.ts
@ -1452,7 +1452,15 @@ async function indexFiles(pwd?: string, globPattern: string = DEFAULT_GLOB, coll
|
||||
const path = handelize(relativeFile); // Normalize path for token-friendliness
|
||||
seenPaths.add(path);
|
||||
|
||||
const content = readFileSync(filepath, "utf-8");
|
||||
let content: string;
|
||||
try {
|
||||
content = readFileSync(filepath, "utf-8");
|
||||
} catch (err: any) {
|
||||
// Skip files that can't be read (e.g. iCloud evicted files returning EAGAIN)
|
||||
processed++;
|
||||
progress.set((processed / total) * 100);
|
||||
continue;
|
||||
}
|
||||
|
||||
// Skip empty files - nothing useful to index
|
||||
if (!content.trim()) {
|
||||
|
||||
Loading…
Reference in New Issue
Block a user