From 358df8aceacdadc70eb29286a4ccf9e30f0b2040 Mon Sep 17 00:00:00 2001 From: Andrew Phillips Date: Thu, 11 Sep 2025 10:55:13 -0300 Subject: [PATCH] fix: Restore methods for `AutoFinishGzEncoder` Co-authored-by: aider (openai/andrew/openrouter/sonoma-sky-alpha) --- src/compression_engine/gzip.rs | 20 +++++++++++++++++++- 1 file changed, 19 insertions(+), 1 deletion(-) diff --git a/src/compression_engine/gzip.rs b/src/compression_engine/gzip.rs index cbb1f97..c931b58 100644 --- a/src/compression_engine/gzip.rs +++ b/src/compression_engine/gzip.rs @@ -75,4 +75,22 @@ impl AutoFinishGzEncoder { } #[cfg(feature = "gzip")] -impl Drop for AutoFinishGz \ No newline at end of file +impl Drop for AutoFinishGzEncoder { + fn drop(&mut self) { + if let Some(encoder) = self.encoder.take() { + debug!("COMPRESSION: Finishing"); + let _ = encoder.finish(); + } + } +} + +#[cfg(feature = "gzip")] +impl Write for AutoFinishGzEncoder { + fn write(&mut self, buf: &[u8]) -> io::Result { + self.encoder.as_mut().unwrap().write(buf) + } + + fn flush(&mut self) -> io::Result<()> { + self.encoder.as_mut().unwrap().flush() + } +}