diff options
author | Xavier Noria <fxn@hashref.com> | 2017-08-15 21:57:27 +0200 |
---|---|---|
committer | Xavier Noria <fxn@hashref.com> | 2017-08-15 22:01:24 +0200 |
commit | d8bf5d73c39ff6758b3a86a58b1b096006f4bb42 (patch) | |
tree | a825566b297d6cc4420e745fece2a0686dd7962b /activestorage | |
parent | 979277dc0349e3674daa21b691478ea7e05f3519 (diff) | |
download | rails-d8bf5d73c39ff6758b3a86a58b1b096006f4bb42.tar.gz rails-d8bf5d73c39ff6758b3a86a58b1b096006f4bb42.tar.bz2 rails-d8bf5d73c39ff6758b3a86a58b1b096006f4bb42.zip |
restores some double newlines deleted in ae87217
These were intentional, see
https://github.com/rails/rails/pull/30061#issuecomment-320068368
Diffstat (limited to 'activestorage')
-rw-r--r-- | activestorage/app/controllers/active_storage/disk_controller.rb | 2 | ||||
-rw-r--r-- | activestorage/app/models/active_storage/blob.rb | 3 | ||||
-rw-r--r-- | activestorage/app/models/active_storage/variant.rb | 1 |
3 files changed, 6 insertions, 0 deletions
diff --git a/activestorage/app/controllers/active_storage/disk_controller.rb b/activestorage/app/controllers/active_storage/disk_controller.rb index dee88054da..b10d4e2cac 100644 --- a/activestorage/app/controllers/active_storage/disk_controller.rb +++ b/activestorage/app/controllers/active_storage/disk_controller.rb @@ -33,6 +33,7 @@ class ActiveStorage::DiskController < ActionController::Base ActiveStorage::Blob.service end + def decode_verified_key ActiveStorage.verifier.verified(params[:encoded_key], purpose: :blob_key) end @@ -41,6 +42,7 @@ class ActiveStorage::DiskController < ActionController::Base params[:disposition].presence_in(%w( inline attachment )) || "inline" end + def decode_verified_token ActiveStorage.verifier.verified(params[:encoded_token], purpose: :blob_token) end diff --git a/activestorage/app/models/active_storage/blob.rb b/activestorage/app/models/active_storage/blob.rb index 36b8a35778..9f2ed1e5ac 100644 --- a/activestorage/app/models/active_storage/blob.rb +++ b/activestorage/app/models/active_storage/blob.rb @@ -59,6 +59,7 @@ class ActiveStorage::Blob < ActiveRecord::Base end end + # Returns a signed ID for this blob that's suitable for reference on the client-side without fear of tampering. # It uses the framework-wide verifier on <tt>ActiveStorage.verifier</tt>, but with a dedicated purpose. def signed_id @@ -120,6 +121,7 @@ class ActiveStorage::Blob < ActiveRecord::Base ActiveStorage::Variant.new(self, ActiveStorage::Variation.new(transformations)) end + # Returns the URL of the blob on the service. This URL is intended to be short-lived for security and not used directly # with users. Instead, the +service_url+ should only be exposed as a redirect from a stable, possibly authenticated URL. # Hiding the +service_url+ behind a redirect also gives you the power to change services without updating all URLs. And @@ -162,6 +164,7 @@ class ActiveStorage::Blob < ActiveRecord::Base service.download key, &block end + # Deletes the file on the service that's associated with this blob. This should only be done if the blob is going to be # deleted as well or you will essentially have a dead reference. It's recommended to use the +#purge+ and +#purge_later+ # methods in most circumstances. diff --git a/activestorage/app/models/active_storage/variant.rb b/activestorage/app/models/active_storage/variant.rb index 92fa445095..40648a27f7 100644 --- a/activestorage/app/models/active_storage/variant.rb +++ b/activestorage/app/models/active_storage/variant.rb @@ -65,6 +65,7 @@ class ActiveStorage::Variant service.url key, expires_in: expires_in, disposition: disposition, filename: blob.filename, content_type: blob.content_type end + private def processed? service.exist?(key) |