compress/gzip: Enforce that reader implements io.ByteReader
with multistream disabled.
#53491
Labels
FrozenDueToAge
NeedsInvestigation
Someone must examine and confirm this is a valid issue and not a duplicate of an existing one.
What version of Go are you using (
go version
)?Does this issue reproduce with the latest release?
Yes.
What operating system and processor architecture are you using (
go env
)?n/a
What did you do?
If you pass an
*os.File
(which implementsio.Reader
) togzip.Reader
and disable multi-stream (.Multistream(false)
), the.Reset(r)
call will return EOF after the first gzip stream despite there being more streams in the file.https://go.dev/play/p/NEdhYQNfKds
Notice that we wrote two chunks to the file (named "hello" and "world") but only one was read (the first, "hello").
What did you expect to see?
One of two things:
io.ByteReader
What did you see instead?
Only the first stream is read.
This behavior is very subtly noted in the documentation:
However, a runtime check and error for interface compatibility would be far more intuitive.
The text was updated successfully, but these errors were encountered: