list folders with source, if the source is not working but there are other virtual children
Massimo Melina committed
Mar 23, 2025 at 14:56 UTC
0e255d6fd39a5601f7c6e984c536c2b2df70f638
2 files changed
+2
-2
src/api.get_file_list.ts
+1
-1
@@ -115,7 +115,7 @@ export const get_file_list: ApiHandler = async ({ uri='/', offset, limit, c, onl
115
return name ? { n: name, url, target: node.target } : null
116
const isFolder = await nodeIsDirectory(node)
117
try {
118
- const st = source ? node.stats || await stat(source) : undefined
118
+ const st = source && !isFolder ? node.stats || await stat(source) : undefined
119
const pl = node.can_list === WHO_NO_ONE ? 'l'
120
: !hasPermission(node, 'can_list', ctx) ? 'L'
121
: ''
src/vfs.ts
+1
-1
@@ -303,7 +303,7 @@ export async function* walkNode(parent: VfsNode, {
303
taken?.add(normalizeFilename(name))
304
const item = { ...child, name }
305
if (await cantSee(item)) continue
306
- if (item.source) // real items must be accessible
306
+ if (item.source && !item.children?.length) // real items must be accessible, unless there's more to it
307
try { await fs.access(item.source) }
308
catch { continue }
309
const isFolder = await nodeIsDirectory(child)