1
0
Fork 0
mirror of https://github.com/rails/rails.git synced 2022-11-09 12:12:34 -05:00

Merge pull request #37490 from huacnlee/fix-aws-public-acl

Ensure public-read ACL for S3 service with public mode.
This commit is contained in:
Gannon McGibbon 2019-11-05 15:53:39 -05:00 committed by GitHub
commit 1404da2649
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 7 additions and 1 deletions

View file

@ -17,8 +17,10 @@ module ActiveStorage
@bucket = @client.bucket(bucket)
@multipart_upload_threshold = upload.fetch(:multipart_threshold, 100.megabytes)
@upload_options = upload
@public = public
@upload_options = upload
@upload_options[:acl] = "public-read" if public?
end
def upload(key, io, checksum: nil, filename: nil, content_type: nil, disposition: nil, **)

View file

@ -10,6 +10,10 @@ if SERVICE_CONFIGURATIONS[:s3_public]
include ActiveStorage::Service::SharedServiceTests
test "public acl options" do
assert_equal "public-read", @service.upload_options[:acl]
end
test "public URL generation" do
url = @service.url(@key, filename: ActiveStorage::Filename.new("avatar.png"))