1
0
Fork 0
mirror of https://gitlab.com/famedly/conduit.git synced 2025-08-01 17:38:36 +00:00

fix(media): return an error when content is failed to be parsed as an image

This commit is contained in:
Matthias Ahouansou 2025-02-04 14:36:07 +00:00
parent e952522a39
commit 30855cef81
No known key found for this signature in database
2 changed files with 12 additions and 10 deletions

View file

@ -348,9 +348,9 @@ async fn get_content_thumbnail(
) -> Result<get_content_thumbnail::v1::Response, Error> {
let mxc = format!("mxc://{}/{}", server_name, media_id);
if let Ok(Some(FileMeta {
if let Some(FileMeta {
file, content_type, ..
})) = services()
}) = services()
.media
.get_thumbnail(
mxc.clone(),
@ -361,7 +361,7 @@ async fn get_content_thumbnail(
.try_into()
.map_err(|_| Error::BadRequest(ErrorKind::InvalidParam, "Height is invalid."))?,
)
.await
.await?
{
Ok(get_content_thumbnail::v1::Response { file, content_type })
} else if server_name != services().globals.server_name() && allow_remote {