aboutsummaryrefslogtreecommitdiffstats
path: root/activestorage/app
diff options
context:
space:
mode:
authorGeorge Claghorn <george.claghorn@gmail.com>2018-01-08 10:35:05 -0500
committerGitHub <noreply@github.com>2018-01-08 10:35:05 -0500
commitedcd32edadd0d6d6b505f59436d05c6a890d4d7c (patch)
treee2fc3933684a49ddaf30ee007fc30ab97d15a58f /activestorage/app
parent7c69351277edaa47ee395c72d59623162eb8682f (diff)
parent8f52d93576ec23c8e87c96f048585445f871efe5 (diff)
downloadrails-edcd32edadd0d6d6b505f59436d05c6a890d4d7c.tar.gz
rails-edcd32edadd0d6d6b505f59436d05c6a890d4d7c.tar.bz2
rails-edcd32edadd0d6d6b505f59436d05c6a890d4d7c.zip
Merge pull request #31650 from rosa/master
Allow overriding filename in `Blob#service_url`
Diffstat (limited to 'activestorage/app')
-rw-r--r--activestorage/app/models/active_storage/blob.rb2
1 files changed, 1 insertions, 1 deletions
diff --git a/activestorage/app/models/active_storage/blob.rb b/activestorage/app/models/active_storage/blob.rb
index 8fb53fa787..df4f6f6075 100644
--- a/activestorage/app/models/active_storage/blob.rb
+++ b/activestorage/app/models/active_storage/blob.rb
@@ -201,7 +201,7 @@ class ActiveStorage::Blob < ActiveRecord::Base
# 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
# it allows permanent URLs that redirect to the +service_url+ to be cached in the view.
- def service_url(expires_in: service.url_expires_in, disposition: :inline)
+ def service_url(expires_in: service.url_expires_in, disposition: :inline, filename: self.filename)
service.url key, expires_in: expires_in, disposition: forcibly_serve_as_binary? ? :attachment : disposition, filename: filename, content_type: content_type
end