Repository navigation
[Backport v2] fix(content): report a failed read after the content as that error - #1655
Merged
TerryHowe merged 1 commit intoOct 21, 2026
Merged
Conversation
Backport of oras-project#1648 to v2. ensureEOF returned ErrTrailingData for any non-EOF result of the probe read. Return it only when the probe read a byte, and report other read errors as "read failed: %w" so callers can match errors such as io.ErrUnexpectedEOF. Signed-off-by: Gaurav Jadhav <gaurav.vjadhav01@gmail.com>
jadhavgaurav
requested review from
TerryHowe,
Wwwsylvia,
sabre1041 and
shizhMSFT
as code owners
October 21, 2026 08:06
Codecov Reportโ
All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## v2 #1655 +/- ##
==========================================
- Coverage 89.22% 89.08% -0.14%
==========================================
Files 65 65
Lines 5030 5032 +2
==========================================
- Hits 4488 4483 -5
- Misses 533 540 +7
Partials 9 9 โ View full report in Codecov by Harness. ๐ New features to boost your workflow:
|
This was referenced Oct 21, 2026
Merged
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.
Backport of #1648 to
v2.ensureEOFreturnedErrTrailingDatafor any non-EOF result of the probe read, so a source failing after all declared bytes (for example an unexpected EOF on a truncated chunked response) was not matchable witherrors.Is(err, io.ErrUnexpectedEOF). It now returnsErrTrailingDataonly when the probe read a byte, and wraps other errors asread failed: %w.The diff of #1648 applied to
v2without changes, including the new case inTestVerifyReader_Verify. The new case fails on unfixedv2(Verify() error = trailing data) and passes with the fix.go vet,gofmt,go test -race ./content/...andgo test ./...pass.Fixes #1649