feat: placeholder for image that can't be decoded to prevent 400 (#6773)

This commit is contained in:
jif-oai
2025-11-17 17:10:53 +01:00
committed by GitHub
parent 497fb4a19c
commit 7c8d333980
2 changed files with 30 additions and 2 deletions

View File

@@ -1,3 +1,4 @@
use image::ImageError;
use image::ImageFormat;
use std::path::PathBuf;
use thiserror::Error;
@@ -23,3 +24,15 @@ pub enum ImageProcessingError {
source: image::ImageError,
},
}
impl ImageProcessingError {
pub fn is_invalid_image(&self) -> bool {
matches!(
self,
ImageProcessingError::Decode {
source: ImageError::Decoding(_),
..
}
)
}
}