sharpcompress icon indicating copy to clipboard operation
sharpcompress copied to clipboard

Using Reader to extract Uncompressed Zips created in a Streaming manner

Open Poolitzer80 opened this issue 5 years ago • 8 comments

Samplecode.txt I have a zip file zipped by OneDrive. When i call the ExtractAllFiles method and i iterate through the files (the zip has 4 files) a EndOfStream Exception is thrown after the first entry.

I attached the File and some sampleCode to Test it with NUnit OneDrive.zip

Poolitzer80 avatar Sep 08 '19 14:09 Poolitzer80

It is a streamed file using no compression, it works in the latest version as far as I can see.

Erior avatar Apr 22 '20 22:04 Erior

In the new version (0.32.0) this leads to a endless loop.

MartinDemberger avatar Jun 15 '22 11:06 MartinDemberger

hopefully someone can take a look soon

adamhathcock avatar Jun 15 '22 11:06 adamhathcock

https://www.nuget.org/packages/SharpCompress/0.32.1

adamhathcock avatar Jun 20 '22 09:06 adamhathcock

Might have to revert this....logically, I'm not sure this is something to account for:

For an uncompressed file:

  • we don't know where the file stream ends (compressed files we do, ironically, because the compression knows when it's done)
  • and we don't have a size on a streaming file because it's in the trailer.

adamhathcock avatar Jul 26 '22 16:07 adamhathcock

Because we don't search for DataDescriptors for not compressed streams or give reader info of sizes from DirectoryHeaders. Created #686 to fix/show where we need things

Erior avatar Jul 28 '22 18:07 Erior

Did a small implementation for seeking non compressed streams, with some limitations... missing crc32 check, missing 64bit handling, but do check that skipped size matches.

Erior avatar Jul 28 '22 21:07 Erior

still have a problem with nested non-compressed zips but I'm starting to look my patence for these kinds of issues. Scanning ahead for the post data descriptor all that can be done for now

adamhathcock avatar Jul 29 '22 08:07 adamhathcock