From 06bc64ab466f8241e770425a23b146235383129b Mon Sep 17 00:00:00 2001 From: Ennui Langeweile <85590273+EnnuiL@users.noreply.github.com> Date: Sun, 10 Nov 2024 14:39:32 -0300 Subject: [PATCH] Revert back into universal WebP conversion --- apps/labrinth/src/util/img.rs | 33 ++++++--------------------------- 1 file changed, 6 insertions(+), 27 deletions(-) diff --git a/apps/labrinth/src/util/img.rs b/apps/labrinth/src/util/img.rs index 7155d466b..1fef2f6e6 100644 --- a/apps/labrinth/src/util/img.rs +++ b/apps/labrinth/src/util/img.rs @@ -124,33 +124,12 @@ fn process_image( min_aspect_ratio: Option, ) -> Result<(bytes::Bytes, String), ImageError> { match content_type { - "image/gif" => { - if target_width.is_none() && min_aspect_ratio.is_none() { - process_animated_image( - image_bytes, - content_type, - target_width, - min_aspect_ratio, - ) - } else { - // Skip animated image processing for GIFs that won't be modified - // But not before checking if it's indeed a GIF - let format = image::guess_format(&image_bytes)?; - if format == ImageFormat::Gif { - Ok((image_bytes.clone(), "gif".to_string())) - } else { - Err(ImageError::Unsupported( - UnsupportedError::from_format_and_kind( - ImageFormat::Gif.into(), - UnsupportedErrorKind::GenericFeature( - "Attempted to process an invalid GIF!" - .to_owned() - ), - ), - )) - } - } - } + "image/gif" => process_animated_image( + image_bytes, + content_type, + target_width, + min_aspect_ratio, + ), "image/png" => { let decoder = PngDecoder::new(Cursor::new(image_bytes.clone()))?; if decoder.is_apng()? {