From e6cc9af0d752c87df93cc332a645add13e334ab5 Mon Sep 17 00:00:00 2001 From: RhineGST Date: Sun, 28 Dec 2025 01:07:50 +0800 Subject: [PATCH] Fixed the issue where `compress_to_size` damaged files on mac --- src/lib.rs | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/lib.rs b/src/lib.rs index de0c5d2..cee4341 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -259,6 +259,9 @@ pub fn compress_to_size( // If we resize, we should always go for at least a round of compression if !(parameters.width > 0 || parameters.height > 0) && original_size <= max_output_size { + if input_path == output_path { + return Ok(()); + } fs::copy(input_path, output_path).map_err(|e| CaesiumError { message: e.to_string(), code: 10202,