fix(gallery): catch StandardError

This commit is contained in:
Eric Leroy-Terquem 2024-06-10 11:29:50 +02:00
parent ab522a3e40
commit 603bb97679
No known key found for this signature in database
GPG key ID: ECE60B4C1FA2ABB3

View file

@ -9,19 +9,19 @@ module GalleryHelper
def preview_url_for(attachment)
attachment.preview(resize_to_limit: [400, 400]).processed.url
rescue ActiveStorage::Error
rescue StandardError
'pdf-placeholder.png'
end
def variant_url_for(attachment)
attachment.variant(resize_to_limit: [400, 400]).processed.url
rescue ActiveStorage::Error
rescue StandardError
'apercu-indisponible.png'
end
def blob_url(attachment)
attachment.blob.content_type.in?(RARE_IMAGE_TYPES) ? attachment.variant(resize_to_limit: [2000, 2000]).processed.url : attachment.blob.url
rescue ActiveStorage::Error
rescue StandardError
attachment.blob.url
end
end