Only list keys starting with / (#14)
This commit is contained in:
parent
3d5ceaf054
commit
0f036f799f
1 changed files with 2 additions and 2 deletions
|
|
@ -90,13 +90,13 @@ app.get('/', async (c) => {
|
||||||
}
|
}
|
||||||
|
|
||||||
let { prefix, cursor, limit: limitStr } = c.req.query()
|
let { prefix, cursor, limit: limitStr } = c.req.query()
|
||||||
prefix = prefix ? decodeURIComponent(prefix) : ''
|
prefix = prefix ? decodeURIComponent(prefix) : '/'
|
||||||
cursor = cursor ? decodeURIComponent(cursor) : ''
|
cursor = cursor ? decodeURIComponent(cursor) : ''
|
||||||
let limit = limitStr ? parseInt(decodeURIComponent(limitStr)) : 1000
|
let limit = limitStr ? parseInt(decodeURIComponent(limitStr)) : 1000
|
||||||
|
|
||||||
let { keys, ...list } = await c.env.KV.list({
|
let { keys, ...list } = await c.env.KV.list({
|
||||||
limit,
|
limit,
|
||||||
prefix,
|
prefix: prefix.startsWith('/') ? prefix : '/' + prefix,
|
||||||
cursor,
|
cursor,
|
||||||
})
|
})
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue