From 92012b979526f6810904836cd242dab1d57fbe44 Mon Sep 17 00:00:00 2001 From: Chris Hennick <4961925+Pr0methean@users.noreply.github.com> Date: Fri, 24 May 2024 21:55:18 -0700 Subject: [PATCH] chore: Tweaks to make `version_needed` and `version_made_by` work with recently-merged changes --- src/types.rs | 2 +- src/write.rs | 5 +---- 2 files changed, 2 insertions(+), 5 deletions(-) diff --git a/src/types.rs b/src/types.rs index 0c2863de..a185d02f 100644 --- a/src/types.rs +++ b/src/types.rs @@ -770,7 +770,7 @@ impl ZipFileData { .unwrap_or_else(DateTime::default_for_write); ZipCentralEntryBlock { magic: ZipCentralEntryBlock::MAGIC, - version_made_by: (self.system as u16) << 8 | (self.version_made_by as u16), + version_made_by: (self.system as u16) << 8 | (self.version_made_by as u16).max(self.version_needed()), version_to_extract: self.version_needed(), flags: self.flags(), compression_method: self.compression_method.serialize_to_u16(), diff --git a/src/write.rs b/src/write.rs index af06cae7..b63d1de4 100644 --- a/src/write.rs +++ b/src/write.rs @@ -795,10 +795,7 @@ impl ZipWriter { aes_mode, extra_field, ); - let version_needed = file.version_needed(); - file.version_made_by = file.version_made_by.max(version_needed as u8); - let version_needed = file.version_needed(); - file.version_made_by = file.version_made_by.max(version_needed as u8); + file.version_made_by = file.version_made_by.max(file.version_needed() as u8); let index = self.insert_file_data(file)?; let file = &mut self.files[index]; let writer = self.inner.get_plain();