-
Notifications
You must be signed in to change notification settings - Fork 1.3k
[miniflare] R2 local public bucket fixes #14323
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
tahmid-23
wants to merge
9
commits into
cloudflare:main
Choose a base branch
from
tahmid-23:r2-local-public-bucket-fixes
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
+161
−25
Open
Changes from all commits
Commits
Show all changes
9 commits
Select commit
Hold shift + click to select a range
f3d9971
[miniflare] Match r2.dev's write and precondition errors on the local…
tahmid-23 48afb90
[miniflare] Reject malformed, multiple, and inverted ranges with 400 …
tahmid-23 3ba32ac
[miniflare] Honor Range on HEAD requests to the local R2 public endpoint
tahmid-23 39e4169
[miniflare] Fix Content-Range for suffix ranges on the local R2 publi…
tahmid-23 380e85f
[miniflare] Reject unsatisfiable ranges with 416 on the local R2 publ…
tahmid-23 789177a
[miniflare] Decode object keys exactly once on the local R2 public en…
tahmid-23 2d672fa
[miniflare] Cancel unread object bodies when serving R2 objects
tahmid-23 72537be
Add a changeset for the local R2 public bucket fixes and body cancell…
tahmid-23 fc86e2c
fix: format public.spec.ts to pass CI checks
devin-ai-integration[bot] File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,5 @@ | ||
| --- | ||
| "miniflare": patch | ||
| --- | ||
|
|
||
| Fix edge cases on the local R2 public bucket endpoint (`/cdn-cgi/local/r2/public`) to match r2.dev: write methods are rejected with 401, malformed/multiple/inverted ranges with 400 and unsatisfiable ranges (including `bytes=-0`) with 416, `Range` is honored on HEAD requests with a bodyless 206, `Content-Range` is correct for suffix ranges, and object keys are percent-decoded exactly once (keys containing a literal `%` no longer fail). Unread object bodies are also cancelled (on HEAD and unsatisfiable-range responses) instead of leaking a read stream until garbage collection. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🚩 412 response no longer includes object headers — intentional behavioral change
The old code at this line returned
c.body(null, { status: 412, headers: objectHeaders(recheck) }), including ETag, Last-Modified, etc. in the 412 response. The new code returnsc.body(null, 412)with no headers at all. Per RFC 7232 §4.2, a 412 response SHOULD include entity headers. The PR intends to match r2.dev behavior, and the tests only assert the status code, so this appears intentional. Worth confirming this matches actual r2.dev responses if fidelity is important.Was this helpful? React with 👍 or 👎 to provide feedback.