fix: list onlyFiles not working with search
Massimo Melina committed
Mar 12, 2026 at 10:47 UTC
61c384a34dc2feccb8cf0a40bb77c491eb91dd06
3 files changed
+11
-1
src/vfs.ts
+1
-1
@@ -406,7 +406,7 @@ export async function* walkNode(parent: VfsNode, {
406
finally {
407
await childrenWorking
408
for (const [item, name] of visitLater)
409
- for await (const x of walkNode(item, { depth: depth - 1, prefixPath: name + '/', ctx, requiredPerm, onlyFolders, parallelizeRecursion }))
409
+ for await (const x of walkNode(item, { depth: depth - 1, prefixPath: name + '/', ctx, requiredPerm, onlyFolders, onlyFiles, parallelizeRecursion }))
410
stream.push(x)
411
stream.push(null)
412
}
tests/config.yaml
+9
@@ -95,6 +95,15 @@ vfs:
95
can_archive: true
96
- name: cantSearchForMasks
97
source: ..
98
+ - name: onlyFilesDeep
99
+ can_see:
100
+ this: false
101
+ children:
102
+ - name: top
103
+ children:
104
+ - name: mid
105
+ children:
106
+ - source: ../alfa.txt
107
- name: cantReadBut
108
source: ..
109
can_read: false
tests/test.ts
+1
@@ -129,6 +129,7 @@ describe('basics', () => {
129
test('cantListBut.parent', reqList('/', { permInList: { 'cantListBut/': 'l' } }))
130
test('cantListBut.child masked', reqList('/cantListBut/page', 200))
131
test('cantSearchForMasks', reqList('/', { outList: ['cantSearchForMasks/page/gpl.png'] }, { search: 'gpl' }))
132
+ test('onlyFiles.deep', reqList('/onlyFilesDeep', { outList: ['top/mid/'] }, { onlyFiles: true, search: 'mid' }))
133
test('cantReadBut', reqList('/cantReadBut/', 403))
134
test('cantReadBut.can', req('/cantReadBut/alfa.txt', 200))
135
test('cantReadBut.parent', reqList('/', { permInList: { 'cantReadBut/': '!r' } }))