Skip to content

Commit

Permalink
fix: implementation of allFileIdsRec not forwarding the prefix on rec…
Browse files Browse the repository at this point in the history
…ursive call (#52)
  • Loading branch information
marianogoldman authored Dec 20, 2022
1 parent 6e7defd commit 0c86407
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 1 deletion.
2 changes: 1 addition & 1 deletion src/folder-based-storage-component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ export async function createFolderBasedFileSystemContentStorage(
const dirEntries = await components.fs.opendir(folder, { bufferSize: 4000 })
for await (const entry of dirEntries) {
if (entry.isDirectory()) {
yield* allFileIdsRec(path.resolve(folder, entry.name))
yield* allFileIdsRec(path.resolve(folder, entry.name), prefix)
} else if (!prefix || entry.name.startsWith(prefix)) {
yield entry.name.replace(/\.gzip/, '')
}
Expand Down
1 change: 1 addition & 0 deletions test/fileSystemContentStorage.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -116,6 +116,7 @@ describe('fileSystemContentStorage', () => {
for await (const key of await fileSystemContentStorage.allFileIds(prefix)) {
filtered.push(key)
}
expect(filtered.length).toBe(expected.length)
for (const filteredKey of expected) {
expect(filtered).toContain(filteredKey)
}
Expand Down

0 comments on commit 0c86407

Please sign in to comment.