fix: harden compression boundaries and target search

This commit is contained in:
237899745
2026-07-25 12:23:35 +08:00
parent 0ff9eae56d
commit 61fa9cb820
9 changed files with 787 additions and 169 deletions

View File

@@ -456,7 +456,10 @@ async fn process_task_file(
} else {
(original_size.saturating_sub(compressed_size) as f64) * 100.0 / (original_size as f64)
};
let skip_charge = compression_rate == Some(100);
let skip_charge = compression_rate == Some(100)
&& format_in == format_out
&& max_width.is_none()
&& max_height.is_none();
let charge_units = !skip_charge && compressed_size < original_size;
if ctx.is_anonymous && charge_units {