fix: vfs items with non-existing source shouldn't be listed
Massimo Melina committed
May 9, 2023 at 00:18 UTC
7b158d7f98e73f1792094c801fc159faacda97d6
1 file changed
+3
src/vfs.ts
+3
@@ -230,6 +230,9 @@ export async function* walkNode(parent:VfsNode, ctx?: Koa.Context, depth:number=
230
took?.add(name)
231
const item = { ...child, name }
232
if (!canSee(item)) continue
233
+ if (item.source) // real items must be accessible
234
+ try { await fs.access(item.source) }
235
+ catch { continue }
236
yield item
237
if (!depth || !await nodeIsDirectory(child).catch(() => false)) continue
238
inheritMasks(item, parent, nodeName)