haf / DotNetZip.Semverd

Please use System.IO.Compression! A fork of the DotNetZip project without signing with a solution that compiles cleanly. This project aims to follow semver to avoid versioning conflicts. DotNetZip is a FAST, FREE class library and toolset for manipulating zip files. Use VB, C# or any .NET language to easily create, extract, or update zip files.
Other
545 stars 218 forks source link

Copy of ZipEntry to another ZipFile does not copy the content #269

Open nikolay-tzonev opened 1 year ago

nikolay-tzonev commented 1 year ago

I am trying to merge the content of multiple zip files into one without unzipping and zipping the files.

I wanted to use the ZipEntry.CloneForNewZipFile(ZipFile) method to clone the entries and add them to the new ZipFile. However after saving the merged ZipFile only the headers appear to be copies and none of the compressed content.

I tracked the problem to line 2561 in .\src\Zip.Shared\ZipEntry.Write.cs

this._TotalEntrySize = this._LengthOfHeader + this._CompressedFileDataSize + _LengthOfTrailer;

where this._CompressedFileDataSize was 0. It never got initialized when calling ZipEntry.CloneForNewZipFile(ZipFile)

Can you please fix this?

Thank you!