chore: Switch to ok_or_abort_file, and inline when that fails borrow checker

This commit is contained in:
Chris Hennick 2024-06-14 19:01:16 -07:00
parent e3ccaf6e00
commit c7116f54d6
No known key found for this signature in database
GPG key ID: DA47AABA4961C509

View file

@ -953,9 +953,13 @@ impl<W: Write + Seek> ZipWriter<W> {
let extra_data_len = extra_data.len();
if extra_data_len > 0 {
let result = (|| {
ExtendedFileOptions::validate_extra_data(
&extra_data,
header_end - zip64_start,
)?;
writer.write_all(&extra_data)?;
extra_data_end = writer.stream_position()?;
ExtendedFileOptions::validate_extra_data(&extra_data, header_end - zip64_start)
Ok(())
})();
if let Err(e) = result {
let _ = self.abort_file();