pkg/registry: return 202 Accepted for PATCH chunk uploads#2265
Merged
Subserial merged 3 commits intoApr 16, 2026
Conversation
retryError consumed resp.Body with io.ReadAll but discarded the bytes, leaving the body closed. When the retry loop exhausted its attempts and called CheckError, that function tried to read the same body and found nothing, producing a generic "unexpected status code" error instead of the structured registry error (e.g. MANIFEST_UNKNOWN). After reading the body, restore it with io.NopCloser(bytes.NewReader(b)) so subsequent callers see the same bytes. Fixes google#2125 Signed-off-by: alliasgher <alliasgher123@gmail.com>
The OCI Distribution spec (§10.5) and Docker Registry API require HTTP 202 Accepted for successful chunk upload PATCH responses. The registry was returning 204 No Content, which caused clients that strictly validate the response code to fail or behave unexpectedly. Update the two PATCH response paths in blobs.go and the corresponding test expectations. Fixes google#2198 Signed-off-by: alliasgher <alliasgher123@gmail.com>
Codecov Report✅ All modified and coverable lines are covered by tests.
Additional details and impacted files@@ Coverage Diff @@
## main #2265 +/- ##
===========================================
- Coverage 71.67% 52.93% -18.75%
===========================================
Files 123 165 +42
Lines 9935 11208 +1273
===========================================
- Hits 7121 5933 -1188
- Misses 2115 4561 +2446
- Partials 699 714 +15 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
Signed-off-by: alliasgher <alliasgher123@gmail.com>
Subserial
approved these changes
Apr 16, 2026
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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Fixes #2198. The OCI Distribution spec requires 202 Accepted for chunk upload PATCH responses; the registry was returning 204 No Content. Updated both PATCH paths in blobs.go and the corresponding test expectations.