Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Merged
merged 9 commits into from
Mar 21, 2022
Merged

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

merged 9 commits into from
Mar 21, 2022

Conversation

jhwz
Copy link
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
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?

formats.go Outdated Show resolved Hide resolved
Co-authored-by: Matt Holt <mholt@users.noreply.github.com>
Copy link
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 join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants