[System.IO.Compression] Lower minimum version in ZIP headers for compatibility.
authorJoao Matos <joao@tritao.eu>
Mon, 22 Feb 2016 14:53:09 +0000 (14:53 +0000)
committerJoao Matos <joao@tritao.eu>
Mon, 22 Feb 2016 14:53:09 +0000 (14:53 +0000)
This fixes compatibility with tools like MS Excel, file tool, and others that do not know how to recognize newer ZIP version formats.

Fixes https://bugzilla.xamarin.com/show_bug.cgi?id=33553.

mcs/class/System.IO.Compression/SharpCompress/Writer/Zip/ZipCentralDirectoryEntry.cs
mcs/class/System.IO.Compression/SharpCompress/Writer/Zip/ZipWriter.cs

index da5d94f4104783dab29d78f2c3df0b4fb4be8ab4..5060897cb9abf3b3fa7ceb7419e65d548f5e1def 100644 (file)
@@ -22,7 +22,7 @@ namespace SharpCompress.Writer.Zip
             byte[] encodedFilename = Encoding.UTF8.GetBytes(FileName);
             byte[] encodedComment = Encoding.UTF8.GetBytes(Comment);
 
-            outputStream.Write(new byte[] {80, 75, 1, 2, 0x3F, 0, 0x0A, 0}, 0, 8);
+            outputStream.Write(new byte[] {80, 75, 1, 2, 0x14, 0, 0x0A, 0}, 0, 8);
             HeaderFlags flags = HeaderFlags.UTF8;
             if (!outputStream.CanSeek)
             {
index 70a2eb7d8c4f103c144008895004176361d72d19..846d78c8e4f20264f1172846ef292c69a45ad28f 100644 (file)
@@ -142,7 +142,7 @@ namespace SharpCompress.Writer.Zip
             byte[] encodedFilename = encoding.GetBytes(filename);
 
             OutputStream.Write(BitConverter.GetBytes(ZipHeaderFactory.ENTRY_HEADER_BYTES), 0, 4);
-            OutputStream.Write(new byte[] {63, 0}, 0, 2); //version
+            OutputStream.Write(new byte[] {20, 0}, 0, 2); //version
             HeaderFlags flags = encoding == Encoding.UTF8 ? HeaderFlags.UTF8 : (HeaderFlags)0;
             if (!OutputStream.CanSeek)
             {