Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 16 additions & 4 deletions packages/core/src/search/searcher.ts
Original file line number Diff line number Diff line change
Expand Up @@ -276,17 +276,29 @@ async function* walkFiles(dir: string): AsyncGenerator<string> {
for (const entry of entries) {
const absPath = join(dir, entry.name);

if (entry.isDirectory()) {
// For symlinks, stat() follows the link to get the real type.
// entry.isDirectory() / entry.isFile() return false for symlinks.
let isDir = entry.isDirectory();
let isFile = entry.isFile();
if (entry.isSymbolicLink()) {
try {
const s = await stat(absPath);
isDir = s.isDirectory();
isFile = s.isFile();
} catch {
continue; // broken symlink — skip
}
}

if (isDir) {
if (!IGNORED_NAMES.has(entry.name)) {
yield* walkFiles(absPath);
}
} else if (entry.isFile()) {
} else if (isFile) {
if (!IGNORED_FILES.has(entry.name)) {
yield absPath;
}
}
// symlinks: follow only if they point to files (readdir withFileTypes
// resolves symlinks on most platforms)
}
}

Expand Down
Loading