Skip to content
This repository was archived by the owner on Nov 19, 2024. It is now read-only.

Retain underlying reader if it's an io.Seeker#327

Merged
mholt merged 9 commits intomholt:masterfrom
jhwz:master
Mar 21, 2022
Merged

Retain underlying reader if it's an io.Seeker#327
mholt merged 9 commits intomholt:masterfrom
jhwz:master

Conversation

@jhwz
Copy link
Copy Markdown
Contributor

@jhwz jhwz commented Mar 21, 2022

See the new test case in formats_test.go.

Because we return an io.MultiReader, we lose a lot of the methods on the interface. This means that when we identify a ZIP file, it cannot then be read with the returned reader.

All this PR does is check if the underlying reader implements io.Seeker, and if so return that instead.

Copy link
Copy Markdown
Owner

@mholt mholt left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ah, that's a good point. Thanks for testing this. How about this one bit of feedback?

Comment thread formats.go Outdated
Co-authored-by: Matt Holt <mholt@users.noreply.github.com>
Copy link
Copy Markdown
Owner

@mholt mholt left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM. Thanks for another great contribution and for the test case, too!

@mholt mholt merged commit d3e979a into mholt:master Mar 21, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants