aboutsummaryrefslogtreecommitdiffstats
path: root/app
diff options
context:
space:
mode:
authorDavid Heinemeier Hansson <david@loudthinking.com>2017-07-23 10:56:53 -0500
committerDavid Heinemeier Hansson <david@loudthinking.com>2017-07-23 10:56:53 -0500
commit9e81741b342a1a8a1ace94d356e023031d386689 (patch)
tree226e630c7433d57458358a948dd885c8d0df6eea /app
parent5ada4314c3272b1d6fc6bd15b2c0a9285c1227aa (diff)
downloadrails-9e81741b342a1a8a1ace94d356e023031d386689.tar.gz
rails-9e81741b342a1a8a1ace94d356e023031d386689.tar.bz2
rails-9e81741b342a1a8a1ace94d356e023031d386689.zip
Disk controller must rely on key alone
Otherwise it can't be used to display variants. It's better anyway since all other services won't know about blobs either. Better simulation. Closes #71
Diffstat (limited to 'app')
-rw-r--r--app/controllers/active_storage/disk_controller.rb11
1 files changed, 6 insertions, 5 deletions
diff --git a/app/controllers/active_storage/disk_controller.rb b/app/controllers/active_storage/disk_controller.rb
index ae8cbddefa..62380a3774 100644
--- a/app/controllers/active_storage/disk_controller.rb
+++ b/app/controllers/active_storage/disk_controller.rb
@@ -11,17 +11,18 @@
class ActiveStorage::DiskController < ActionController::Base
def show
if key = decode_verified_key
- blob = ActiveStorage::Blob.find_by!(key: key)
-
- if stale?(etag: blob.checksum)
- send_data blob.download, filename: blob.filename, type: blob.content_type, disposition: disposition_param
- end
+ # FIXME: Find a way to set the correct content type
+ send_data disk_service.download(key), filename: params[:filename], disposition: disposition_param
else
head :not_found
end
end
private
+ def disk_service
+ ActiveStorage::Blob.service
+ end
+
def decode_verified_key
ActiveStorage::VerifiedKeyWithExpiration.decode(params[:encoded_key])
end