We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
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
0.4.1
I came a cross this panic when I was trying to decompress a ZIP file with two .zip suffixes. It's easy to reproduce:
.zip
Decompressing a file like test.zip.zip with two suffixes causes the program to panic.
test.zip.zip
The program should decompress the file normally and guess the file's type using the last suffix.
No response
The text was updated successfully, but these errors were encountered:
Hey @k4yt3x, thanks a lot for the report!
Sorry, something went wrong.
Panic happens here:
ouch/src/commands/decompress.rs
Line 89 in a3e1eb4
There's not zip::read::Decoder or something that would impl Read from the zip crate, as far as I know
zip::read::Decoder
impl Read
One thing we could do is do this instead
let chain_reader_decoder = |format: &CompressionFormat, decoder: Box<dyn Read>| -> crate::Result<Box<dyn Read>> { let decoder: Box<dyn Read> = match format { Gzip => Box::new(flate2::read::GzDecoder::new(decoder)), Bzip => Box::new(bzip2::read::BzDecoder::new(decoder)), Lz4 => Box::new(lzzzz::lz4f::ReadDecompressor::new(decoder)?), Lzma => Box::new(xz2::read::XzDecoder::new(decoder)), Snappy => Box::new(snap::read::FrameDecoder::new(decoder)), Zstd => Box::new(zstd::stream::Decoder::new(decoder)?), Tar | Zip => decoder, // Return the decoder itself }; Ok(decoder) };
Doing this, if passed in something like file.tar.zip or file.zip.zip, we'd unpack the outer compression, save file.tar | file.zip and finish
file.tar.zip
file.zip.zip
file.tar | file.zip
The user could then re-run ouch on the resulting file
@marcospb19 @figsoda I opened the PR for the change above, am open to suggestions
.tar.zip
.zip.zip
Successfully merging a pull request may close this issue.
Version
0.4.1
Description
I came a cross this panic when I was trying to decompress a ZIP file with two
.zip
suffixes. It's easy to reproduce:Current Behavior
Decompressing a file like
test.zip.zip
with two suffixes causes the program to panic.Expected Behavior
The program should decompress the file normally and guess the file's type using the last suffix.
Additional Information
No response
The text was updated successfully, but these errors were encountered: