aboutsummaryrefslogtreecommitdiffstats
path: root/activestorage/lib/active_storage/service.rb
diff options
context:
space:
mode:
Diffstat (limited to 'activestorage/lib/active_storage/service.rb')
-rw-r--r--activestorage/lib/active_storage/service.rb7
1 files changed, 7 insertions, 0 deletions
diff --git a/activestorage/lib/active_storage/service.rb b/activestorage/lib/active_storage/service.rb
index b80fdea1ab..1f012da1e7 100644
--- a/activestorage/lib/active_storage/service.rb
+++ b/activestorage/lib/active_storage/service.rb
@@ -4,6 +4,7 @@ require "active_storage/log_subscriber"
module ActiveStorage
class IntegrityError < StandardError; end
+
# Abstract class serving as an interface for concrete services.
#
# The available services are:
@@ -42,6 +43,8 @@ module ActiveStorage
class_attribute :logger
+ class_attribute :url_expires_in, default: 5.minutes
+
class << self
# Configure an Active Storage service by name from a set of configurations,
# typically loaded from a YAML file. The Active Storage engine uses this
@@ -113,5 +116,9 @@ module ActiveStorage
# ActiveStorage::Service::DiskService => Disk
self.class.name.split("::").third.remove("Service")
end
+
+ def content_disposition_with(type: "inline", filename:)
+ (type.to_s.presence_in(%w( attachment inline )) || "inline") + "; #{filename.parameters}"
+ end
end
end