Skip to content

Commit

Permalink
fix regression in scan's filter
Browse files Browse the repository at this point in the history
  • Loading branch information
bdistin authored May 13, 2020
1 parent bbe11c6 commit c8ebc53
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion src/nextra/scan.ts
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,9 @@ async function scanDeep(path: string, results: Map<string, Dirent>, level: numbe
const dir = await fsp.opendir(path);

for await (const dirent of dir) {
if (!options.filter || options.filter(dirent, path)) results.set(join(path, dirent.name), dirent);
const fullPath = join(path, dirent.name);

if (!options.filter || options.filter(dirent, fullPath)) results.set(fullPath, dirent);
if (dirent.isDirectory() && (typeof options.depthLimit === 'undefined' || level < options.depthLimit)) {
await scanDeep(join(path, dirent.name), results, level + 1, options);
}
Expand Down

0 comments on commit c8ebc53

Please sign in to comment.