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:
commit
1404da2649
2 changed files with 7 additions and 1 deletions
|
@ -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, **)
|
||||
|
|
|
@ -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"))
|
||||
|
||||
|
|
Loading…
Reference in a new issue