You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Compression Method Stored leads to corrupt archive #492
With the current library from Nuget (1.2), I get a corrupt archive, if I use this code:
If I dont have CompressionMethod.Stored, then the archive works, but the uncompressed files are always few bytes bigger than the original files. I need the files to be exactly the same (original size = size of file in ZIP archive).
I have fixed this whole thing for myself before (see my older issue), but in 1.2, this still seems to be flawed.
Best
Martin
publicZipWriter(string filename){_sziFilename=filename;FileStreamfsOut=File.Create(_sziFilename);_zipStream=newZipOutputStream(fsOut);_zipStream.SetLevel(0);//0-9, 9 being the highest level of compression}publicvoidAddFileToZip(stringfilenameInZip,MemoryStreammemTile){memTile.Position=0;DateTimecreationTimeUtc=DateTime.Now;stringentryName=filenameInZip;entryName=ZipEntry.CleanName(entryName);// Removes drive from name and fixes slash directionvarnewEntry=newZipEntry(entryName){DateTime=creationTimeUtc,CompressionMethod=CompressionMethod.Stored,Size=memTile.Length,};_zipStream.PutNextEntry(newEntry);// Zip the file in buffered chunks// the "using" will close the stream even if an exception occursbyte[]buffer=newbyte[4096];StreamUtils.Copy(memTile,_zipStream,buffer);_zipStream.CloseEntry();
Activity
Numpsy commentedon Aug 3, 2020
you mean #398?
The issue was hopefully fixed in #406, but that hasn't found its way in to an official release yet.
piksel commentedon Aug 4, 2020
Yeah, hopefully 1.3 will be out pretty soon!
piksel commentedon Nov 10, 2020
I am closing this as it should be fixed in the current release. If not, please make a new issue.