aboutsummaryrefslogtreecommitdiffstats
path: root/app/controllers/active_storage/disk_controller.rb
diff options
context:
space:
mode:
authorDavid Heinemeier Hansson <david@loudthinking.com>2017-07-24 14:16:55 -0500
committerDavid Heinemeier Hansson <david@loudthinking.com>2017-07-24 14:16:55 -0500
commitbb3458079e11c4a22271559413be4c9b901b4790 (patch)
tree70e767628ecaea7fcce6bc0a0f60587e5837a48c /app/controllers/active_storage/disk_controller.rb
parent6de1c0b7b5c35d0f1a19efc7c9d65af825d977ba (diff)
downloadrails-bb3458079e11c4a22271559413be4c9b901b4790.tar.gz
rails-bb3458079e11c4a22271559413be4c9b901b4790.tar.bz2
rails-bb3458079e11c4a22271559413be4c9b901b4790.zip
Finish basic documentation for controllers
Diffstat (limited to 'app/controllers/active_storage/disk_controller.rb')
-rw-r--r--app/controllers/active_storage/disk_controller.rb18
1 files changed, 6 insertions, 12 deletions
diff --git a/app/controllers/active_storage/disk_controller.rb b/app/controllers/active_storage/disk_controller.rb
index 986eee6504..ff10cfba84 100644
--- a/app/controllers/active_storage/disk_controller.rb
+++ b/app/controllers/active_storage/disk_controller.rb
@@ -1,18 +1,12 @@
-# This controller is a wrapper around local file downloading. It allows you to
-# make abstraction of the URL generation logic and to serve files with expiry
-# if you are using the +Disk+ service.
-#
-# By default, mounting the Active Storage engine inside your application will
-# define a +/rails/blobs/:encoded_key/*filename+ route that will reference this
-# controller's +show+ action and will be used to serve local files.
-#
-# A URL for an attachment can be generated through its +#url+ method, that
-# will use the aforementioned route.
+# Serves files stored with the disk service in the same way that the cloud services do.
+# This means using expiring, signed URLs that are meant for immediate access, not permanent linking.
+# Always go through the BlobsController, or your own authenticated controller, rather than directly
+# to the service url.
class ActiveStorage::DiskController < ActionController::Base
def show
if key = decode_verified_key
- # FIXME: Do we need to sign or otherwise validate the content type?
- send_data disk_service.download(key), filename: params[:filename], disposition: disposition_param, content_type: params[:content_type]
+ send_data disk_service.download(key),
+ filename: params[:filename], disposition: disposition_param, content_type: params[:content_type]
else
head :not_found
end