@samitouri / QOSami-HFS / commits / f18aa929

fix: list onlyFiles not working with search

Massimo Melina committed Mar 12, 2026 at 10:47 UTC f18aa929b14b71caa12ccd00b4dbd20ae3397201
3 files changed +11 -1
src/vfs.ts
+1 -1
@@ -403,7 +403,7 @@ export async function* walkNode(parent: VfsNode, {
403 finally {
404 await childrenWorking
405 for (const [item, name] of visitLater)
406 - for await (const x of walkNode(item, { depth: depth - 1, prefixPath: name + '/', ctx, requiredPerm, onlyFolders, parallelizeRecursion }))
406 + for await (const x of walkNode(item, { depth: depth - 1, prefixPath: name + '/', ctx, requiredPerm, onlyFolders, onlyFiles, parallelizeRecursion }))
407 stream.push(x)
408 stream.push(null)
409 }
tests/config.yaml
+9
@@ -98,6 +98,15 @@ vfs:
98 can_archive: true
99 - name: cantSearchForMasks
100 source: ..
101 + - name: onlyFilesDeep
102 + can_see:
103 + this: false
104 + children:
105 + - name: top
106 + children:
107 + - name: mid
108 + children:
109 + - source: ../alfa.txt
110 - name: cantReadBut
111 source: ..
112 can_read: false
tests/test.ts
+1
@@ -115,6 +115,7 @@ describe('basics', () => {
115 test('cantListBut.parent', reqList('/', { permInList: { 'cantListBut/': 'l' } }))
116 test('cantListBut.child masked', reqList('/cantListBut/page', 200))
117 test('cantSearchForMasks', reqList('/', { outList: ['cantSearchForMasks/page/gpl.png'] }, { search: 'gpl' }))
118 + test('onlyFiles.deep', reqList('/onlyFilesDeep', { outList: ['top/mid/'] }, { onlyFiles: true, search: 'mid' }))
119 test('cantReadBut', reqList('/cantReadBut/', 403))
120 test('cantReadBut.can', req('/cantReadBut/alfa.txt', 200))
121 test('cantReadBut.parent', reqList('/', { permInList: { 'cantReadBut/': '!r' } }))