Skip to content

Commit

Permalink
Avoid asking the cloud if an image exists
Browse files Browse the repository at this point in the history
#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.
  • Loading branch information
mkllnk committed Oct 23, 2019
1 parent 02c0b89 commit ada34d2
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion app/serializers/api/admin/enterprise_serializer.rb
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ def find_match(tag_groups, tags)
# # 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)
Expand Down

0 comments on commit ada34d2

Please sign in to comment.