Skip to content

Commit

Permalink
Merge pull request #2525 from yosiat/fog-google-copy-object
Browse files Browse the repository at this point in the history
GCS: pass acl_header for public read if fog is public
  • Loading branch information
thiagofm authored Jan 18, 2021
2 parents 3faf749 + 92a69de commit 09f9f27
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 0 deletions.
2 changes: 2 additions & 0 deletions lib/carrierwave/storage/fog.rb
Original file line number Diff line number Diff line change
Expand Up @@ -497,6 +497,8 @@ def file
def acl_header
if fog_provider == 'AWS'
{ 'x-amz-acl' => @uploader.fog_public ? 'public-read' : 'private' }
elsif fog_provider == "Google"
@uploader.fog_public ? { destination_predefined_acl: "publicRead" } : {}
else
{}
end
Expand Down
3 changes: 3 additions & 0 deletions spec/storage/fog_helper.rb
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,9 @@ def check_file
if @provider == 'AWS'
expect(@storage.connection).to receive(:copy_object)
.with(anything, anything, anything, anything, { "x-amz-acl"=>"public-read" }).and_call_original
elsif @provider == 'Google'
expect(@storage.connection).to receive(:copy_object)
.with(anything, anything, anything, anything, { destination_predefined_acl: "publicRead" }).and_call_original
else
expect(@storage.connection).to receive(:copy_object)
.with(anything, anything, anything, anything, {}).and_call_original
Expand Down

0 comments on commit 09f9f27

Please sign in to comment.