aboutsummaryrefslogtreecommitdiffstats
path: root/activestorage/lib/active_storage
diff options
context:
space:
mode:
Diffstat (limited to 'activestorage/lib/active_storage')
-rw-r--r--activestorage/lib/active_storage/service/disk_service.rb11
1 files changed, 7 insertions, 4 deletions
diff --git a/activestorage/lib/active_storage/service/disk_service.rb b/activestorage/lib/active_storage/service/disk_service.rb
index 75b66081c3..5b652fe74e 100644
--- a/activestorage/lib/active_storage/service/disk_service.rb
+++ b/activestorage/lib/active_storage/service/disk_service.rb
@@ -78,8 +78,9 @@ module ActiveStorage
verified_key_with_expiration = ActiveStorage.verifier.generate(key, expires_in: expires_in, purpose: :blob_key)
generated_url =
- url_helpers.rails_disk_service_path(
+ url_helpers.rails_disk_service_url(
verified_key_with_expiration,
+ host: current_host,
filename: filename,
disposition: content_disposition_with(type: disposition, filename: filename),
content_type: content_type
@@ -104,7 +105,7 @@ module ActiveStorage
purpose: :blob_token }
)
- generated_url = url_helpers.update_rails_disk_service_path(verified_token_with_expiration)
+ generated_url = url_helpers.update_rails_disk_service_url(verified_token_with_expiration, host: current_host)
payload[:url] = generated_url
@@ -129,7 +130,6 @@ module ActiveStorage
path_for(key).tap { |path| FileUtils.mkdir_p File.dirname(path) }
end
-
def ensure_integrity_of(key, checksum)
unless Digest::MD5.file(path_for(key)).base64digest == checksum
delete key
@@ -137,9 +137,12 @@ module ActiveStorage
end
end
-
def url_helpers
@url_helpers ||= Rails.application.routes.url_helpers
end
+
+ def current_host
+ ActiveStorage::Current.host
+ end
end
end