Skip to content

Commit

Permalink
Support disabled mode
Browse files Browse the repository at this point in the history
  • Loading branch information
alextwoods committed Aug 9, 2023
1 parent c504e96 commit 51176d7
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 6 deletions.
2 changes: 1 addition & 1 deletion gems/aws-sdk-s3/lib/aws-sdk-s3/customizations/object.rb
Original file line number Diff line number Diff line change
Expand Up @@ -498,7 +498,7 @@ def upload_file(source, options = {})
# checksum validation fails. You may provide a `on_checksum_validated`
# callback if you need to verify that validation occurred and which
# algorithm was used. To disable checksum validation, set
# `checksum_mode` to either `false` or `nil`.
# `checksum_mode` to "DISABLED" or false.
#
# @option options [Callable] on_checksum_validated Called each time a
# request's checksum is validated with the checksum algorithm and the
Expand Down
8 changes: 4 additions & 4 deletions gems/aws-sdk-s3/lib/aws-sdk-s3/file_downloader.rb
Original file line number Diff line number Diff line change
Expand Up @@ -33,10 +33,10 @@ def download(destination, options = {})
@params[:version_id] = options[:version_id] if options[:version_id]

# checksum_mode only supports the value "ENABLED"
# falsey values (false/nil) should be considered disabled and
# the api parameter should be unset.
if options.fetch(:checksum_mode, 'ENABLED')
@params[:checksum_mode] = options.fetch(:checksum_mode, 'ENABLED')
# falsey values (false/nil) or "DISABLED" should be considered
# disabled and the api parameter should be unset.
if (checksum_mode = options.fetch(:checksum_mode, 'ENABLED'))
@params[:checksum_mode] = checksum_mode unless checksum_mode.upcase == 'DISABLED'
end
@on_checksum_validated = options[:on_checksum_validated]

Expand Down
2 changes: 1 addition & 1 deletion gems/aws-sdk-s3/spec/object/download_file_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -231,7 +231,7 @@ module S3
response_target: path
}).exactly(1).times

small_obj.download_file(path, checksum_mode: nil)
small_obj.download_file(path, checksum_mode: 'DISABLED')
end

it 'raises an error if an invalid mode is specified' do
Expand Down

0 comments on commit 51176d7

Please sign in to comment.