Fix broken thumbnails (#4661)

* Check is_image_post flag

* Keep cargo_fmt happy

* Filter on is_image_post

* Trigger CI

* Keep cargo_fmt happy
This commit is contained in:
Kroese 2024-04-24 04:52:56 +02:00 committed by GitHub
parent 0eaf8d33e7
commit 6b9d9dfaa5
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -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,
}