diff --git a/CHANGELOG.md b/CHANGELOG.md index da190dc7..be5fc267 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -114,7 +114,7 @@ ## [0.7.4] -### Changed +### Merged from upstream - Added experimental [`zip_next::unstable::write::FileOptions::with_deprecated_encryption`] API to enable encrypting files with PKWARE encryption. diff --git a/src/write.rs b/src/write.rs index 5652933c..6a41d337 100644 --- a/src/write.rs +++ b/src/write.rs @@ -513,6 +513,14 @@ impl ZipWriter { .inner .prepare_next_writer(CompressionMethod::Stored, None)?; self.inner.switch_to(make_plain_writer)?; + match mem::replace(&mut self.inner, Closed) { + Storer(MaybeEncrypted::Encrypted(writer)) => { + let crc32 = self.stats.hasher.clone().finalize(); + self.inner = Storer(MaybeEncrypted::Unencrypted(writer.finish(crc32)?)) + } + Storer(w) => self.inner = Storer(w), + _ => unreachable!() + } let writer = self.inner.get_plain(); if !self.writing_raw {