Skip to content

R2 list() returns percent-encoded keys for non-ASCII and % characters, and get() with them returns null #232

Closed

Description

@northys

R2Bucket.list() returns keys that contain non-ASCII characters or % in percent-encoded form. A get() with the listed key returns null. ASCII keys, including keys with spaces, list unchanged, and get() with the original key works.

Reproduction

wrangler.jsonc:

{
  "name": "r2-list-repro",
  "main": "index.js",
  "compatibility_date": "2026-01-01",
  "r2_buckets": [{ "binding": "FILES", "bucket_name": "files" }]
}

index.js:

export default {
  async fetch(request, env) {
    const keys = ["přehled.html", "plain.html", "with space.html", "100%.html"];
    for (const key of keys) await env.FILES.put(key, "hello");
    const listed = (await env.FILES.list()).objects.map((o) => o.key);
    const results = [];
    for (const key of listed) results.push({ listed: key, getWorks: (await env.FILES.get(key)) !== null });
    return Response.json(results);
  },
};

Result

A node with --bucket s3://… against MinIO RELEASE.2025-04-22T22-12-26Z, celld 0.5.1:

[
  {"listed": "100%25.html", "getWorks": false},
  {"listed": "p%C5%99ehled.html", "getWorks": false},
  {"listed": "plain.html", "getWorks": true},
  {"listed": "with space.html", "getWorks": true}
]

The bucket holds the objects as r2/files/p%C5%99ehled.html and r2/files/100%25.html. list() seems to return the stored name without reversing the encoding that put() applies.

celld dev, 0.5.0 and 0.5.1, adds a second layer: p%25C5%2599ehled.html and 100%2525.html.

Expected

list() returns přehled.html and 100%.html, the keys passed to put(), as Cloudflare R2 does.

Environment

celld 0.5.0 and 0.5.1, aarch64-apple-darwin build, both celld dev and a node on an S3 bucket in MinIO RELEASE.2025-04-22T22-12-26Z.

Activity

  1. self-assigned this
    on Sep 25, 2026
  2. bartlomieju commented on Sep 25, 2026

    @bartlomieju
    Member

    Thanks for the report, this is now fixed and will be released in the next version.

  3. added 3 commits that reference this issue on Sep 26, 2026
  4. added a commit that references this issue on Sep 26, 2026
  5. added 3 commits that reference this issue on Sep 26, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions