File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 4040// HISTORY
4141// 22-12-2009 Z-1649 Added AES support
4242// 22-02-2010 Z-1648 Zero byte entries would create invalid zip files
43+ // 27-07-2012 Z-1724 Compressed size was incorrect in local header when CRC and Size are known
4344
4445using System ;
4546using System . IO ;
@@ -280,7 +281,7 @@ public void PutNextEntry(ZipEntry entry)
280281 }
281282 else
282283 {
283- headerInfoAvailable = ( entry . Size >= 0 ) && entry . HasCrc ;
284+ headerInfoAvailable = ( entry . Size >= 0 ) && entry . HasCrc && entry . CompressedSize >= 0 ;
284285
285286 // Switch to deflation if storing isnt possible.
286287 if ( method == CompressionMethod . Stored )
@@ -343,7 +344,7 @@ public void PutNextEntry(ZipEntry entry)
343344 WriteLeInt ( ( int ) entry . DosTime ) ;
344345
345346 // TODO: Refactor header writing. Its done in several places.
346- if ( headerInfoAvailable == true ) {
347+ if ( headerInfoAvailable ) {
347348 WriteLeInt ( ( int ) entry . Crc ) ;
348349 if ( entry . LocalHeaderRequiresZip64 ) {
349350 WriteLeInt ( - 1 ) ;
You can’t perform that action at this time.
0 commit comments