From 5e0b216320a332918e34cdeacf0ac67e859bb695 Mon Sep 17 00:00:00 2001 From: Chris Hennick Date: Thu, 4 May 2023 12:34:31 -0700 Subject: [PATCH] Bug fix --- src/write.rs | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/src/write.rs b/src/write.rs index 79c1769d..a71af4cb 100644 --- a/src/write.rs +++ b/src/write.rs @@ -909,8 +909,11 @@ impl ZipWriter { self.start_entry(name, options, None)?; self.writing_to_file = true; - self.write_all(target.into().as_bytes())?; - self.writing_to_file = false; + if let Err(e) = self.write_all(target.into().as_bytes()) { + self.abort_file().unwrap(); + return Err(e.into()); + } + self.finish_file()?; Ok(()) }