Apply suggestions from code review.
Co-authored-by: Mitsuhiro Shibuya <mit.shibuya@gmail.com>
This commit is contained in:
parent
cdc14f8106
commit
807e743e84
|
@ -487,7 +487,7 @@ module CarrierWave
|
|||
def copy_options
|
||||
options = {}
|
||||
options.merge!(acl_header) if acl_header.present?
|
||||
options['Content-Type'] = options[:content_type] ||= content_type if content_type
|
||||
options[fog_provider == "Google" ? :content_type : 'Content-Type'] ||= content_type if content_type
|
||||
options.merge(@uploader.fog_attributes)
|
||||
end
|
||||
|
||||
|
|
|
@ -606,15 +606,14 @@ end
|
|||
if @provider == 'AWS'
|
||||
expect(@storage.connection).to receive(:copy_object)
|
||||
.with(anything, anything, anything, anything,
|
||||
{ "Content-Type"=>@fog_file.content_type, content_type: @fog_file.content_type, "x-amz-acl"=>"public-read", 'x-amz-server-side-encryption' => 'AES256' }).and_call_original
|
||||
{ "Content-Type"=>@fog_file.content_type, "x-amz-acl"=>"public-read", 'x-amz-server-side-encryption' => 'AES256' }).and_call_original
|
||||
elsif @provider == 'Google'
|
||||
expect(@storage.connection).to receive(:copy_object)
|
||||
.with(anything, anything, anything, anything,
|
||||
{ "Content-Type"=>@fog_file.content_type, content_type: @fog_file.content_type, destination_predefined_acl: "publicRead" }).and_call_original
|
||||
{ content_type: @fog_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"=>@fog_file.content_type, content_type: @fog_file.content_type }).and_call_original
|
||||
.with(anything, anything, anything, anything, { "Content-Type"=>@fog_file.content_type }).and_call_original
|
||||
end
|
||||
|
||||
@fog_file.copy_to('uploads/new_path.jpg')
|
||||
|
@ -625,16 +624,14 @@ end
|
|||
it 'includes acl_header when necessary' do
|
||||
if @provider == 'AWS'
|
||||
expect(@storage.connection).to receive(:copy_object)
|
||||
.with(anything, anything, anything, anything,
|
||||
{ "Content-Type"=>@fog_file.content_type, content_type: @fog_file.content_type, "x-amz-acl"=>"public-read" }).and_call_original
|
||||
.with(anything, anything, anything, anything, { "Content-Type"=>@fog_file.content_type, "x-amz-acl"=>"public-read" }).and_call_original
|
||||
elsif @provider == 'Google'
|
||||
expect(@storage.connection).to receive(:copy_object)
|
||||
.with(anything, anything, anything, anything,
|
||||
{ "Content-Type"=>@fog_file.content_type, content_type: @fog_file.content_type, destination_predefined_acl: "publicRead" }).and_call_original
|
||||
{ content_type: @fog_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"=>@fog_file.content_type, content_type: @fog_file.content_type }).and_call_original
|
||||
.with(anything, anything, anything, anything, { "Content-Type"=>@fog_file.content_type }).and_call_original
|
||||
end
|
||||
|
||||
@fog_file.copy_to('uploads/new_path.jpg')
|
||||
|
|
Loading…
Reference in New Issue