From 888e5fac16cac17f97df3019e3da870ab7218129 Mon Sep 17 00:00:00 2001
From: Chris Hennick <4961925+Pr0methean@users.noreply.github.com>
Date: Sun, 2 Jun 2024 16:09:19 -0700
Subject: [PATCH] fix: Switch padding field ID to one documented in APPNOTE

---
 src/write.rs | 7 +++++--
 1 file changed, 5 insertions(+), 2 deletions(-)

diff --git a/src/write.rs b/src/write.rs
index c5c8798e..ec708d59 100644
--- a/src/write.rs
+++ b/src/write.rs
@@ -881,9 +881,12 @@ impl<W: Write + Seek> ZipWriter<W> {
                         ));
                     };
                     if pad_length >= 4 {
-                        // Add an extra field to the extra_data
+                        // Add an extra field to the extra_data, per APPNOTE 4.6.11
                         let pad_body = vec![0; pad_length - 4];
-                        writer.write_all(b"za").map_err(ZipError::from)?; // 0x617a
+                        if pad_body.len() >= 2 {
+                            pad_body[0..2].write_u16_le(options.alignment)?;
+                        }
+                        writer.write_u16_le(0xa11e)?;
                         writer
                             .write_u16_le(pad_body.len() as u16)
                             .map_err(ZipError::from)?;