Skip to content

Commit

Permalink
fix: omit meta keys for getKeys
Browse files Browse the repository at this point in the history
  • Loading branch information
pi0 committed Sep 8, 2021
1 parent 3a5d865 commit 34dec7d
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 2 deletions.
4 changes: 3 additions & 1 deletion src/storage.ts
Original file line number Diff line number Diff line change
Expand Up @@ -129,7 +129,9 @@ export function createStorage (opts: CreateStorageOptions = {}): Storage {
return rawKeys.map(key => mount.mountpoint + normalizeKey(key))
}))
const keys = keyGroups.flat()
return base ? keys.filter(key => key.startsWith(base!)) : keys
return base
? keys.filter(key => key.startsWith(base!) && !key.endsWith('$'))
: keys.filter(key => !key.endsWith('$'))
},
// Utils
async clear (base) {
Expand Down
2 changes: 1 addition & 1 deletion test/server.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ describe('server', () => {

expect(await fetchStorage('foo/bar', { method: 'PUT', body: 'updated' })).toBe('OK')
expect(await fetchStorage('foo/bar')).toBe('updated')
expect(await fetchStorage('/')).toMatchObject(['foo/bar', 'foo/bar$'])
expect(await fetchStorage('/')).toMatchObject(['foo/bar'])

expect(await fetchStorage('foo/bar', { method: 'DELETE' })).toBe('OK')
expect(await fetchStorage('foo/bar', {})).toMatchObject([])
Expand Down

0 comments on commit 34dec7d

Please sign in to comment.