Compare commits

...

1 Commits

Author SHA1 Message Date
Maikel Linke
95819c9a0f 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.
2019-10-23 11:45:15 +11:00

View File

@@ -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)