mirror of
https://github.com/adamhathcock/sharpcompress.git
synced 2026-02-03 21:23:38 +00:00
[PR #452] [MERGED] Various fixes for ZIP64 writer (zero byte entries, 32 bit where supported) #1034
Reference in New Issue
Block a user
Delete Branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
📋 Pull Request Information
Original PR: https://github.com/adamhathcock/sharpcompress/pull/452
Author: @Lssikkes
Created: 5/24/2019
Status: ✅ Merged
Merged: 5/24/2019
Merged by: @adamhathcock
Base:
master← Head:master📝 Commits (1)
9319ea6Updated ZIP64 writer to write 32 bit values to directory entries for better compatibility.📊 Changes
2 files changed (+19 additions, -6 deletions)
View changed files
📝
src/SharpCompress/Writers/Zip/ZipCentralDirectoryEntry.cs(+11 -6)📝
src/SharpCompress/Writers/Zip/ZipWriter.cs(+8 -0)📄 Description
To improve compatibility with older ZIP clients I've modified the directory headers to write the corresponding 32 bit values if values still fit in 32 bits (this will allow them to read as if it's a ZIP32, and able to completely ignore the extra ZIP64 fields in ZIP headers if the decompressed size <= 32 bits)
Another problem fixed in order not to trip up 7-zip/WinRAR, zero byte files need to have compression value 0 (STORED). Now with zero byte files in the archive they will validate correctly.
I've tested these changes on WinRAR, 7-zip and windows explorer .zip (Windows 10 RS5), and using the latest changes don't get any complaints anymore extracting ZIP/ZIP64.
🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.