-
Notifications
You must be signed in to change notification settings - Fork 976
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
Use CompressionMethod.Stored and flush the ZipOutputStream after each entity was added leads Zip corrupted in SharpZipLib 1.4.2 #834
Comments
This comment was marked as off-topic.
This comment was marked as off-topic.
You are adding the same file many times, using the same name. Most archivers would probably only display that as a single file entry. Could you upload the output file to ArchiveDiag and post the URL to the resulting analysis here? |
@piksel Yes that just a sample, just let you know that I added multiple files |
Sorry, further test shows that this issue related to FlushAsync() on ZipOutputStream, here is the demo. |
In short, if CompressionMethod is not CompressionMethod.Stored or do not flush the ZipOutputStream after insert a new entry, this issue disappeared. |
I tried to reproduce your issue but it works correctly: |
Demo application SharpZipLibTest.zip will try zip your Screenshots folder in 4 different ways, output zip file will be placed on your desktop. Test1.zip is corrupted and Test2.zip & Test3.zip Test4.zip are correct. Please check code of the demo application |
@piksel Could you reproduce this issue using the demo application? |
Describe the bug
I found a bug that if I set
CompressionMethod = CompressionMethod.Stored
in the entry and flush the ZipOutputStream, the output zip is corrupted and only the first file exists in the zip file.Reproduction Code
No response
Steps to reproduce
Expected behavior
Zip is not corrupted
Operating System
Windows
Framework Version
.NET 7
Tags
ZIP
Additional context
No response
The text was updated successfully, but these errors were encountered: