Hacktoberfest 2026: los issues que los mantenedores marcaron para octubre, abiertos y aptos para principiantes. Explorar issues de Hacktoberfest

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

Abierto
#113 1 comentario 0 reacciones 0 asignados Ver en GitHub

Los mantenedores suelen responder en 1 día

Nadie ha tomado este issue todavía.

Evaluación

Dificultad
3/5
Tiempo estimado
1-2 días
Aptitud para principiantes
72/100
Tipo de issue
Error
Claridad
Bastante claro
Estado de actividad
Activo
Stack tecnológico
typescript
Área
cli

Línea de trabajo

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.

Escrito por el modelo de indexación a partir del texto del issue.

Descripción

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.

Lenguaje dominante
TypeScript
Estrellas
916
Forks
53
Merge medio
23 h 30 min
PR fusionados (30 d)
216

Preparar el entorno

Primeros pasos

  1. Lee el issue completo y luego la guía de contribución del proyecto.
  2. Comenta en el issue que vas a ocuparte — evita que dos personas hagan lo mismo.
  3. Haz un fork del repositorio y trabaja en una rama.
  4. Abre un pull request que haga referencia al número del issue.

Más de cloudflare/cf

Todos los issues de cloudflare/cf

Issues similares

Más issues de TypeScript

Recibe los nuevos issues en tu correo

Un resumen breve de issues de GitHub para principiantes.