diff --git a/lib/carrierwave/storage/fog.rb b/lib/carrierwave/storage/fog.rb index 9993ea817..342712446 100644 --- a/lib/carrierwave/storage/fog.rb +++ b/lib/carrierwave/storage/fog.rb @@ -450,7 +450,7 @@ def filename(options = {}) # @return [CarrierWave::Storage::Fog::File] the location where the file will be stored. # def copy_to(new_path) - connection.copy_object(@uploader.fog_directory, file.key, @uploader.fog_directory, new_path, uploader_options) + connection.copy_object(@uploader.fog_directory, file.key, @uploader.fog_directory, new_path, copy_options) CarrierWave::Storage::Fog::File.new(@uploader, @base, new_path) end @@ -494,7 +494,7 @@ def file @file ||= directory.files.head(path) end - def uploader_options + def copy_options options = {} options.merge!(acl_header) if acl_header.present? options['Content-Type'] ||= content_type if content_type diff --git a/spec/storage/fog_helper.rb b/spec/storage/fog_helper.rb index 34ff36d70..0ad056c51 100644 --- a/spec/storage/fog_helper.rb +++ b/spec/storage/fog_helper.rb @@ -57,7 +57,7 @@ def check_file end end - context '#uploader_options' do + context '#copy_options' do let(:store_path) { 'uploads/test+.jpg' } let(:fog_attributes) { { 'x-amz-server-side-encryption' => true } } @@ -75,6 +75,9 @@ def check_file expect(@storage.connection).to receive(:copy_object) .with(anything, anything, anything, anything, { "Content-Type"=>file.content_type, "x-amz-acl"=>"public-read", 'x-amz-server-side-encryption' => true }).and_call_original + elsif @provider == 'Google' + expect(@storage.connection).to receive(:copy_object) + .with(anything, anything, anything, anything, { "Content-Type"=>file.content_type, destination_predefined_acl: "publicRead" }).and_call_original else expect(@storage.connection).to receive(:copy_object) .with(anything, anything, anything, anything, { "Content-Type"=>file.content_type }).and_call_original