mirror of
https://git.kescher.at/CatCatNya/catstodon.git
synced 2024-11-27 19:41:37 +01:00
Fix CSP when dealing with S3 hosts
This commit is contained in:
parent
9f25ab9792
commit
58720aa2bd
1 changed files with 3 additions and 1 deletions
|
@ -7,9 +7,11 @@ if Rails.env.production?
|
||||||
data_hosts = [assets_host]
|
data_hosts = [assets_host]
|
||||||
|
|
||||||
if ENV['S3_ENABLED'] == 'true'
|
if ENV['S3_ENABLED'] == 'true'
|
||||||
attachments_host = ENV['S3_ALIAS_HOST'] || ENV['S3_CLOUDFRONT_HOST'] || ENV['S3_HOSTNAME'] || "s3-#{ENV['S3_REGION'] || 'us-east-1'}.amazonaws.com"
|
attachments_host = "https://#{ENV['S3_ALIAS_HOST'] || ENV['S3_CLOUDFRONT_HOST'] || ENV['S3_HOSTNAME'] || "s3-#{ENV['S3_REGION'] || 'us-east-1'}.amazonaws.com"}"
|
||||||
|
attachments_host = "https://#{Addressable::URI.parse(attachments_host).host}"
|
||||||
elsif ENV['SWIFT_ENABLED'] == 'true'
|
elsif ENV['SWIFT_ENABLED'] == 'true'
|
||||||
attachments_host = ENV['SWIFT_OBJECT_URL']
|
attachments_host = ENV['SWIFT_OBJECT_URL']
|
||||||
|
attachments_host = "https://#{Addressable::URI.parse(attachments_host).host}"
|
||||||
else
|
else
|
||||||
attachments_host = nil
|
attachments_host = nil
|
||||||
end
|
end
|
||||||
|
|
Loading…
Reference in a new issue