diff options
author | George Claghorn <george@basecamp.com> | 2017-09-13 22:43:54 -0400 |
---|---|---|
committer | George Claghorn <george@basecamp.com> | 2017-09-13 22:44:04 -0400 |
commit | cffa32f95d2934cfafc22958f35552ee6e7c195e (patch) | |
tree | ea762617100eda0d7980f95bb77cb02e3696994a /activestorage | |
parent | f27a45af467abdceff5ac1176d22dad86a09ec0c (diff) | |
download | rails-cffa32f95d2934cfafc22958f35552ee6e7c195e.tar.gz rails-cffa32f95d2934cfafc22958f35552ee6e7c195e.tar.bz2 rails-cffa32f95d2934cfafc22958f35552ee6e7c195e.zip |
Avoid making HTTP requests to generate signed URLs for GCS objects
Diffstat (limited to 'activestorage')
-rw-r--r-- | activestorage/lib/active_storage/service/gcs_service.rb | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/activestorage/lib/active_storage/service/gcs_service.rb b/activestorage/lib/active_storage/service/gcs_service.rb index a0ba5654a1..685dd61a0a 100644 --- a/activestorage/lib/active_storage/service/gcs_service.rb +++ b/activestorage/lib/active_storage/service/gcs_service.rb @@ -36,7 +36,7 @@ module ActiveStorage def delete(key) instrument :delete, key do begin - file_for(key).try(:delete) + file_for(key).delete rescue Google::Cloud::NotFoundError # Ignore files already deleted end @@ -45,7 +45,7 @@ module ActiveStorage def exist?(key) instrument :exist, key do |payload| - answer = file_for(key).present? + answer = file_for(key).exists? payload[:exist] = answer answer end @@ -81,7 +81,7 @@ module ActiveStorage private def file_for(key) - bucket.file(key) + bucket.file(key, skip_lookup: true) end end end |