From b84cb24ab9dbd1470e578f7e8740251fed61c694 Mon Sep 17 00:00:00 2001 From: xenofem Date: Wed, 27 Apr 2022 00:28:26 -0400 Subject: [PATCH] don't say the zipfile was made on unix, it causes trouble with permissions --- src/zip.rs | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/src/zip.rs b/src/zip.rs index 247840a..722644e 100644 --- a/src/zip.rs +++ b/src/zip.rs @@ -129,8 +129,14 @@ impl UploadedFile { fn central_directory_header(&self, local_header_offset: usize, hash: u32) -> Vec { let mut header = vec![ - 0x50, 0x4b, 0x01, 0x02, // Central directory file header signature - 45, 3, // Made by a Unix system supporting version 4.5 + // Central directory file header signature + 0x50, 0x4b, 0x01, 0x02, + // Made by a "DOS" system supporting version 4.5 - if we + // say it's made by a Unix system, then unzip will expect + // it to have embedded Unix permission information, and + // will set all the files to mode 000 when that's not + // present :/ + 45, 0, ]; header.append(&mut self.shared_header_fields(Some(hash))); header.append(&mut vec![ @@ -165,7 +171,7 @@ fn end_of_central_directory(files: &[UploadedFile]) -> Vec { ]; append_0(&mut eocd, 7); // pad out the rest of the size field eocd.append(&mut vec![ - 45, 3, // Made by a Unix system supporting version 4.5 + 45, 0, // Made by a "DOS" system supporting version 4.5, see above 45, 0, // Minimum version 4.5 to extract ]); append_0(&mut eocd, 8); // Two 4-byte disk numbers, both 0