-
Notifications
You must be signed in to change notification settings - Fork 49
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
Add helpful error when trying to decompress gzip-wrapped data #67
Comments
That data has a gzip wrapper around it. The core miniz_oxide doesn't support gzip directly, flate2 will deal with the wrapper if the correct decoder struct is used. Adding support for that to miniz_oxide itself is not really something we've planned as it would pull in some extra dependencies. I would recommend just using flate2, though if you for whatever reason want to avoid that there is a gzip-header crate you can use to parse out the gzip wrapper manually before feeding the compressed data to miniz-oxide. Could maybe make a clearer error type for this though, as the two first bytes of the gzip wrapper are unique. |
Oh, thank you for clarifying what's going on! It makes sense now. I'll let up to you whether to close this or leave it open to track improving the message. |
I don't think this is the responsibility of the library. Input data could be in any number of container formats, and I wouldn't expect the library to be able to identify whatever invalid data it was given |
Maybe it could be added to the documentation? "This error can occur due to various reasons, such as trying to decompress invalid data, data with a gzip header, etc." |
Yeah sounds like a good idea. |
When trying to decompress the following data using this Rust code:
I'm hitting the following error:
Python's
gzip
can decompress it just fine, though:I presume this is the same as sile/libflate#45, which I'm linking because it provides a clearer error message which may be helpful:
I'm not sure if this bug should be filled here, but I guess it can't hurt. Is there any way to make this library decompress the data successfully, or a way to work around it?
I have also tested
flate2
as mentioned in the README, and that's able to decompress the data too.The text was updated successfully, but these errors were encountered: