mirror of
https://github.com/openfoodfoundation/openfoodnetwork
synced 2026-01-24 20:36:49 +00:00
Avoid asking the cloud if an image exists
https://github.com/openfoodfoundation/openfoodnetwork/issues/4392 Amazon's DNS is failing at the moment and some users can't access the admin panel because of this error. While `exists?` asks the storage server if the file is actually there, `file?` just checks if we have the file name stored in the database and the file should be there. It's much faster and less error prone.
This commit is contained in:
@@ -62,7 +62,7 @@ class Api::Admin::EnterpriseSerializer < ActiveModel::Serializer
|
||||
# # medium: LOGO_MEDIUM_URL
|
||||
# # }
|
||||
def attachment_urls(attachment, versions)
|
||||
return unless attachment.exists?
|
||||
return unless attachment.file?
|
||||
|
||||
versions.each_with_object({}) do |version, urls|
|
||||
urls[version] = attachment.url(version)
|
||||
|
||||
Reference in New Issue
Block a user