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
Subfiles of root folder in ZIP archive are ignored #806
Comments
doing a brief test, I saw that the zip was different in that there's a zero byte header somewhere. Using the
|
There is an extra two bytes at the end of the first Local Entry header, Only question I have at the moment is where the |
I imagine 7Zip is also using central directory....I haven't used it in years so don't know if it would report something malformed. I wonder what made that zip file. |
I agree that 7zip is probably just using the CD. However, if they were streaming it in for some reason, it appears 7zip reads the local header and, then, if the item has a data descriptor, it "looks around" for it. So, it can skip over any errant bytes that might be there. Guessing they've seen something like this before? Don't think there is any way for SharpCompress to handle this unless it did the same.
I think, @Eternal-ll , you'll have to avoid a Reader if you want to read these zip files and use one of the other options, @adamhathcock mentioned that uses the Central Directory headers. |
Reader being forward-only has a lot of restrictions that must libs don't do. Not really a good way to workaround this for Readers without loosing what good a Reader is. |
Sure, i used read factory only to expose some internal extraction progress.
It was probably made by desktop client on Java that used implementation below. |
I guess that's the apache implementation putting something extra we don't expect or against spec. Of course, the zip spec is fluid at best |
Ah, I think I see what it is. For some reason, the Apache library is writing out 2 bytes for a directory. No idea what those represent; still puzzling through where ZipArchiveOutputStream and ZipArchiveEntry is getting that in the Apache library. The PostDataDescriptor gives it away because it says the entry is 2 bytes compressed and 0 bytes uncompressed. So, the Apache implementation compressed 0 bytes into 2 bytes. :-P I guess SharpCompress could try to handle arbitrary data for a directory and just discard it? What do you think, @adamhathcock ? EDIT: I think this is actually a bug in the Apache zip library for directories. They flush their deflater to the output stream even if nothing was written. That's why the uncompressed size is 0; they didn't read anything to send to the deflater. |
I mean, we can add an explicit boolean property to handle this but I wouldn't want to add it generically. It does sound like a bug to me. |
Thanks for investigating the issue, i think we can leave things as it is. It is not that much of problem for me as we got alternative solutions. I will contact devs of java client, maybe they would look into that. |
When i extract zip file, only root folder appears in output directory, subfiles are ignored.
SharpCompress 0.36.0
Archive structure
Output folder
Attached file setons_reworked.v0010.zip
Note: .net ZIP impl. works fine
The text was updated successfully, but these errors were encountered: