aboutsummaryrefslogtreecommitdiffstats
path: root/activestorage/app/controllers/concerns/active_storage/set_blob.rb
diff options
context:
space:
mode:
Diffstat (limited to 'activestorage/app/controllers/concerns/active_storage/set_blob.rb')
-rw-r--r--activestorage/app/controllers/concerns/active_storage/set_blob.rb16
1 files changed, 16 insertions, 0 deletions
diff --git a/activestorage/app/controllers/concerns/active_storage/set_blob.rb b/activestorage/app/controllers/concerns/active_storage/set_blob.rb
new file mode 100644
index 0000000000..f072954d78
--- /dev/null
+++ b/activestorage/app/controllers/concerns/active_storage/set_blob.rb
@@ -0,0 +1,16 @@
+# frozen_string_literal: true
+
+module ActiveStorage::SetBlob #:nodoc:
+ extend ActiveSupport::Concern
+
+ included do
+ before_action :set_blob
+ end
+
+ private
+ def set_blob
+ @blob = ActiveStorage::Blob.find_signed(params[:signed_blob_id] || params[:signed_id])
+ rescue ActiveSupport::MessageVerifier::InvalidSignature
+ head :not_found
+ end
+end