Skip to content

Commit

Permalink
Correcly filter file names
Browse files Browse the repository at this point in the history
  • Loading branch information
Murderlon committed Oct 5, 2023
1 parent 3ca5eed commit 597ce34
Showing 1 changed file with 4 additions and 5 deletions.
9 changes: 4 additions & 5 deletions packages/file-store/configstores/FileConfigstore.ts
Original file line number Diff line number Diff line change
Expand Up @@ -38,11 +38,10 @@ export class FileConfigstore implements Configstore {
async list(): Promise<Array<string>> {
return this.queue.add(async () => {
const files = await fs.readdir(this.directory)
// readdir returns files without file extension.
// This means we will get two files,
// the actual file and the JSON info file, per upload.
// We de-duplicate here to only return one ID per upload.
return Array.from(new Set(files))
// list is expected to return an array of IDs,
// which is the same as the file name.
// But the JSON info files are also in the directory so we filter those.
return files.filter((file) => !file.endsWith('.json'))
})
}

Expand Down

0 comments on commit 597ce34

Please sign in to comment.