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:
commit
bffca0cfe2
1 changed files with 3 additions and 3 deletions
|
@ -9,19 +9,19 @@ module GalleryHelper
|
||||||
|
|
||||||
def preview_url_for(attachment)
|
def preview_url_for(attachment)
|
||||||
attachment.preview(resize_to_limit: [400, 400]).processed.url
|
attachment.preview(resize_to_limit: [400, 400]).processed.url
|
||||||
rescue ActiveStorage::Error
|
rescue StandardError
|
||||||
'pdf-placeholder.png'
|
'pdf-placeholder.png'
|
||||||
end
|
end
|
||||||
|
|
||||||
def variant_url_for(attachment)
|
def variant_url_for(attachment)
|
||||||
attachment.variant(resize_to_limit: [400, 400]).processed.url
|
attachment.variant(resize_to_limit: [400, 400]).processed.url
|
||||||
rescue ActiveStorage::Error
|
rescue StandardError
|
||||||
'apercu-indisponible.png'
|
'apercu-indisponible.png'
|
||||||
end
|
end
|
||||||
|
|
||||||
def blob_url(attachment)
|
def blob_url(attachment)
|
||||||
attachment.blob.content_type.in?(RARE_IMAGE_TYPES) ? attachment.variant(resize_to_limit: [2000, 2000]).processed.url : attachment.blob.url
|
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
|
attachment.blob.url
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
Loading…
Reference in a new issue