Skip to content

Commit 7527c64

Browse files
Fix delete manifest infinite loop (#93)
When there are many references in the R2 registry, the delete manifest endpoint responds with a 400 request and a cursor. The `list` call uses `startAfter` which is meant for filenames instead of the `cursor` which makes the `list` call return the same data on each call, despite of what's set in the `last` query parameter. This leads a caller following the `Link` call without checking whether the URL is the same as before to run into an infinite loop.
1 parent 136562c commit 7527c64

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

src/router.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -73,7 +73,7 @@ v2Router.delete("/:name+/manifests/:reference", async (req, env: Env) => {
7373
const tags = await env.REGISTRY.list({
7474
prefix: `${name}/manifests`,
7575
limit: isNaN(limitInt) ? 1000 : limitInt,
76-
startAfter: last?.toString(),
76+
cursor: last?.toString(),
7777
});
7878
for (const tag of tags.objects) {
7979
if (!tag.checksums.sha256) {

0 commit comments

Comments
 (0)