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();