Skip to content

Commit

Permalink
Hotfix for ActiveStorage::InvariableError in ImageHelper
Browse files Browse the repository at this point in the history
  • Loading branch information
ut committed Apr 23, 2024
2 parents d8323f4 + 97a7413 commit 41e4d4c
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 1 deletion.
1 change: 1 addition & 0 deletions app/assets/javascripts/markers/test.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
6 changes: 5 additions & 1 deletion app/helpers/images_helper.rb
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,11 @@ def image_url(file)
filename = ActiveStorage::Blob.service.path_for(file.key)
return unless File.exist?(filename)

polymorphic_url(file.variant(resize: '800x800').processed)
if file.variable?
polymorphic_url(file.variant(resize: '800x800').processed)
else
polymorphic_url(file)
end
rescue Errno::ENOENT => e
'Image not found.'
rescue ActiveStorage::FileNotFoundError => e
Expand Down

0 comments on commit 41e4d4c

Please sign in to comment.