mirror of
https://github.com/chatmail/core.git
synced 2026-05-03 05:16:28 +03:00
simplify condition for jpeg-check
This commit is contained in:
@@ -383,14 +383,11 @@ impl<'a> BlobObject<'a> {
|
|||||||
|
|
||||||
pub async fn recode_to_image_size(&self, context: &Context) -> Result<(), BlobError> {
|
pub async fn recode_to_image_size(&self, context: &Context) -> Result<(), BlobError> {
|
||||||
let blob_abs = self.to_abs_path();
|
let blob_abs = self.to_abs_path();
|
||||||
match message::guess_msgtype_from_suffix(Path::new(&blob_abs)) {
|
if message::guess_msgtype_from_suffix(Path::new(&blob_abs))
|
||||||
None => return Ok(()),
|
!= Some((Viewtype::Image, "image/jpeg"))
|
||||||
Some(imgtype) => {
|
{
|
||||||
if imgtype.1 != "image/jpeg" {
|
|
||||||
return Ok(());
|
return Ok(());
|
||||||
}
|
}
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
let img = image::open(&blob_abs).map_err(|err| BlobError::RecodeFailure {
|
let img = image::open(&blob_abs).map_err(|err| BlobError::RecodeFailure {
|
||||||
blobdir: context.get_blobdir().to_path_buf(),
|
blobdir: context.get_blobdir().to_path_buf(),
|
||||||
|
|||||||
Reference in New Issue
Block a user