From 6b9d9dfaa518e10026c04e0192022b8d6b044517 Mon Sep 17 00:00:00 2001 From: Kroese Date: Wed, 24 Apr 2024 04:52:56 +0200 Subject: [PATCH] Fix broken thumbnails (#4661) * Check is_image_post flag * Keep cargo_fmt happy * Filter on is_image_post * Trigger CI * Keep cargo_fmt happy --- crates/api_common/src/request.rs | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/crates/api_common/src/request.rs b/crates/api_common/src/request.rs index ddb2a4551..abf99f670 100644 --- a/crates/api_common/src/request.rs +++ b/crates/api_common/src/request.rs @@ -105,7 +105,11 @@ pub fn generate_post_link_metadata( } // Generate local thumbnail if allowed else if allow_generate_thumbnail { - match post.url.or(metadata.opengraph_data.image) { + match post + .url + .filter(|_| is_image_post) + .or(metadata.opengraph_data.image) + { Some(url) => generate_pictrs_thumbnail(&url, &context).await.ok(), None => None, }