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

cf r2 objects put percent-encodes '/' in the object key, contrary to its help text (1.0.0-beta.5)

Aperta
#113 1 commento 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
typescript
Ambito
cli

Direzione di ricerca

Start at the cf r2 objects put URL construction and compare its dry-run output with the command's help text and schema. Check how path parameters containing / are encoded, and whether other commands share that behavior. Done means the dry-run URL preserves the object key's slashes as required, with the behavior verified against the issue's reproduction.

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

Descrizione

upstream

Summary

cf r2 objects put --help says:

Slashes (/) within the key MUST be sent literally and MUST NOT be percent-encoded (i.e. %2F)

But the request cf builds percent-encodes them.

Versions

cf 1.0.0-beta.5, Linux

Repro

$ CLOUDFLARE_ACCOUNT_ID=00000000000000000000000000000000 \
  npx cf r2 objects put a/b/c.jpg --bucket-name example-bucket --body x --dry-run
{
  "command": "cf r2 objects put",
  "method": "PUT",
  "url": "https://api.cloudflare.com/client/v4/accounts/00000000000000000000000000000000/r2/buckets/example-bucket/objects/a%2Fb%2Fc.jpg",
  "pathParams": { "bucket-name": "example-bucket", "object-key": "a/b/c.jpg" },
  "bodyKind": "octet-stream",
  "body": "x"
}

cf schema r2 objects put shows the path as /accounts/{account_id}/r2/buckets/{bucket_name}/objects/{object_key}, so the key seems to be encoded like any other path parameter.

Expected

…/objects/a/b/c.jpg, as the help text requires. If the API takes the encoded form literally, objects would be stored as a%2Fb%2Fc.jpg instead of under the a/b/ prefix.

I've only observed this in --dry-run output and haven't confirmed it against a real bucket yet. If the dry-run just displays the URL differently from what is actually sent, the help text or the dry-run output might be worth aligning. Other path-parameter commands whose values can contain / may be affected too.

Lingua principale
TypeScript
Stelle
916
Fork
53
Merge medio
23h 17m
PR unite (30g)
220

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.