Check is_image_post flag

This commit is contained in:
Kroese 2024-04-23 01:58:28 +02:00 committed by GitHub
parent 0eaf8d33e7
commit 5e5b5dd8cf
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -104,8 +104,14 @@ pub fn generate_post_link_metadata(
federated_thumbnail
}
// Generate local thumbnail if allowed
else if allow_generate_thumbnail {
match post.url.or(metadata.opengraph_data.image) {
else if allow_generate_thumbnail && !is_image_post {
match metadata.opengraph_data.image {
Some(url) => generate_pictrs_thumbnail(&url, &context).await.ok(),
None => None,
}
}
else if allow_generate_thumbnail && is_image_post {
match post.url {
Some(url) => generate_pictrs_thumbnail(&url, &context).await.ok(),
None => None,
}