Hacktoberfest 2026: le issue che i maintainer hanno segnato per ottobre, aperte e adatte ai principianti. Sfoglia le issue Hacktoberfest

r2 objects delete and bulk-delete exit 0 without deleting keys that contain '/'

Aperta
#209 0 commenti 0 reazioni 0 assegnatari Vedi su GitHub

I maintainer di solito rispondono entro 1 giorno

Nessuno ha ancora preso questa issue.

Valutazione

Difficoltà
3/5
Tempo stimato
1-2 giorni
Idoneità per principianti
72/100
Tipo di issue
Bug
Chiarezza
Abbastanza chiara
Stato di attività
Attiva
Stack tecnologico
node.js, typescript
Ambito
cli

Direzione di ricerca

Start by locating the r2 objects delete and bulk-delete command implementations and their request-path construction; compare that behavior with the issue's reference to #113 and the CLI help text about literal slashes. Reproduce with a key containing / and inspect the generated request path. Done when both commands delete the exact key and a missing key is not reported as a successful deletion without notice.

Scritto dal modello di indicizzazione a partire dal testo della issue.

Descrizione

upstream
Summary of the issue

cf r2 objects delete and cf r2 objects bulk-delete report success but delete nothing when the object key contains /.

The CLI percent-encodes / in the key as %2F in the request path, the same root cause as #113 for put. R2 answers a DELETE for a key that does not exist with success, so the command exits 0, prints no error, and the real object stays in place. Nothing tells the user that the delete missed.

cf r2 objects get builds the path the same way (--dry-run shows %2F), but it returned the correct object body in our tests, so only deletes failed silently.

This is easy to miss in cleanup scripts. Ours reported 2,220 objects deleted with zero errors, and a re-listing showed that all of them were still in the bucket.

Expected behaviour

The CLI follows its own help text: "Slashes (/) within the key MUST be sent literally and MUST NOT be percent-encoded". The delete removes the object at the given key.

If the request does not match an existing key, the CLI should at least say so instead of exiting 0 silently.

Version of cf used

1.0.0-beta.12

System information and package versions
  • macOS 26.6.2 (arm64)
  • Node.js v22.22.2
  • cf installed globally with npm
  • wrangler 4.77.0, used as the working comparison
Reproduction (optional)
export CLOUDFLARE_ACCOUNT_ID=<account>
echo hi > /tmp/a.txt
cf r2 objects put folder/a.txt --bucket-name <bucket> --file /tmp/a.txt --content-type text/plain

cf r2 objects delete folder/a.txt --bucket-name <bucket> --dry-run
# url ends with .../objects/folder%2Fa.txt

cf r2 objects delete folder/a.txt --bucket-name <bucket>   # exit 0, no error
cf r2 objects list --bucket-name <bucket> --prefix folder/ # object is still listed

wrangler r2 object delete <bucket>/folder/a.txt --remote   # actually deletes it

The bulk-delete delete-by-list mode (--body '["folder/a.txt"]') also exits 0 and leaves the object in place.

Relevant error logs (optional)

There are no errors, which is the problem.

Lingua principale
TypeScript
Stelle
916
Fork
53
Merge medio
18h 26m
PR unite (30g)
177

Preparare l'ambiente

Come iniziare

  1. Leggi tutta la issue e poi la guida ai contributi del progetto.
  2. Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
  3. Fai un fork del repository e lavora su un branch.
  4. Apri una pull request che faccia riferimento al numero della issue.

Altre issue di cloudflare/cf

Tutte le issue di cloudflare/cf

Issue simili

Altre issue su TypeScript

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.