Merge pull request #10504 from demarches-simplifiees/more-error-catching-in-gallery

Correctif (galerie) : catche les erreurs de type ActionViewTemplate
This commit is contained in:
Eric Leroy-Terquem 2024-06-10 13:50:45 +00:00 committed by GitHub
commit bffca0cfe2
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

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