make sure to avoid closing the input reader#2137
Merged
harshavardhana merged 1 commit intominio:masterfrom Jul 21, 2025
Merged
Conversation
0c6fb23 to
43ca9af
Compare
oliverpool
reviewed
Aug 7, 2025
| @@ -84,7 +84,7 @@ func (hr *hookReader) Read(b []byte) (n int, err error) { | |||
| // reports the data read from the source to the hook. | |||
| func newHook(source, hook io.Reader) io.Reader { | |||
| if hook == nil { | |||
There was a problem hiding this comment.
The if could be dropped:
return &hookReader{
source: source,
hook: hook,
}
Should be enough
saschazepter
pushed a commit
to saschazepter/forgejo
that referenced
this pull request
Aug 10, 2025
Fixes #8529, supersedes #8597 Reverts the workaround of #8541 (while keeping the test) and ignore Close error (like #8527 did). minio/minio-go#2137 makes the test pass without the `io.NopCloser`: ``` docker run --rm -e MINIO_DOMAIN=minio -e MINIO_ROOT_USER=123456 -e MINIO_ROOT_PASSWORD=12345678 -p 9000:9000 data.forgejo.org/oci/bitnami/minio:2024.8.17 ``` ``` TEST_MINIO_ENDPOINT=localhost:9000 go test -v -run ^TestMinioStorageIterator$ ./modules/storage ``` Wrapping the `io.Reader` in an `io.NopCloser` also hides all other methods (like `WriteTo` or `Seek`), so is not ideal. As a further "line of defense", the Close error is ignored (if saveAsPackageBlob was succesful, we don't really care if Close fails). Co-authored-by: Renovate Bot <[email protected]> Reviewed-on: https://codeberg.org/forgejo/forgejo/pulls/8816 Reviewed-by: Gusted <[email protected]> Co-authored-by: oliverpool <[email protected]> Co-committed-by: oliverpool <[email protected]>
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.
No description provided.