From c7116f54d625d7bf93feb912e6c82873712a6dcc Mon Sep 17 00:00:00 2001 From: Chris Hennick <4961925+Pr0methean@users.noreply.github.com> Date: Fri, 14 Jun 2024 19:01:16 -0700 Subject: [PATCH] chore: Switch to `ok_or_abort_file`, and inline when that fails borrow checker --- src/write.rs | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/write.rs b/src/write.rs index c4a7a8cde..3dad38fca 100644 --- a/src/write.rs +++ b/src/write.rs @@ -953,9 +953,13 @@ impl ZipWriter { 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();