chore: Bug fix: revert a change where crypto_header was incorrectly treated as an extra field
This commit is contained in:
parent
bf3e7510a6
commit
7f641d23a3
1 changed files with 4 additions and 4 deletions
|
@ -944,9 +944,6 @@ impl<W: Write + Seek> ZipWriter<W> {
|
||||||
.unwrap_or(&Arc::new(vec![]))
|
.unwrap_or(&Arc::new(vec![]))
|
||||||
.clone(),
|
.clone(),
|
||||||
};
|
};
|
||||||
if let Some(EncryptWith::ZipCrypto { .. }) = options.encrypt_with {
|
|
||||||
extensions.add_extra_data(0, Box::new([0u8; 10]), false)?;
|
|
||||||
}
|
|
||||||
let mut extra_data_end = header_end + extensions.extra_data.len() as u64;
|
let mut extra_data_end = header_end + extensions.extra_data.len() as u64;
|
||||||
if options.alignment > 1 {
|
if options.alignment > 1 {
|
||||||
let align = options.alignment as u64;
|
let align = options.alignment as u64;
|
||||||
|
@ -981,12 +978,15 @@ impl<W: Write + Seek> ZipWriter<W> {
|
||||||
self.inner = GenericZipWriter::Storer(MaybeEncrypted::Aes(aeswriter));
|
self.inner = GenericZipWriter::Storer(MaybeEncrypted::Aes(aeswriter));
|
||||||
}
|
}
|
||||||
Some(EncryptWith::ZipCrypto(keys, ..)) => {
|
Some(EncryptWith::ZipCrypto(keys, ..)) => {
|
||||||
let zipwriter = crate::zipcrypto::ZipCryptoWriter {
|
let mut zipwriter = crate::zipcrypto::ZipCryptoWriter {
|
||||||
writer: mem::replace(&mut self.inner, Closed).unwrap(),
|
writer: mem::replace(&mut self.inner, Closed).unwrap(),
|
||||||
buffer: vec![],
|
buffer: vec![],
|
||||||
keys,
|
keys,
|
||||||
};
|
};
|
||||||
|
let crypto_header = [0u8; 12];
|
||||||
|
|
||||||
|
zipwriter.write_all(&crypto_header)?;
|
||||||
|
extra_data_end = zipwriter.writer.stream_position()?;
|
||||||
self.inner = Storer(MaybeEncrypted::ZipCrypto(zipwriter));
|
self.inner = Storer(MaybeEncrypted::ZipCrypto(zipwriter));
|
||||||
}
|
}
|
||||||
None => {}
|
None => {}
|
||||||
|
|
Loading…
Add table
Reference in a new issue