simplify condition for jpeg-check

This commit is contained in:
B. Petersen
2020-06-07 15:56:48 +02:00
parent 17283c86a3
commit f3a59e19d8

View File

@@ -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(),