Change S3 checksum mode to be disabled by default (#27007)

This commit is contained in:
Claire 2023-09-21 14:00:51 +02:00 committed by GitHub
parent bb6c59a399
commit 8acc75435b
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -91,7 +91,6 @@ if ENV['S3_ENABLED'] == 'true'
# Some S3-compatible providers might not actually be compatible with some APIs # Some S3-compatible providers might not actually be compatible with some APIs
# used by kt-paperclip, see https://github.com/mastodon/mastodon/issues/16822 # used by kt-paperclip, see https://github.com/mastodon/mastodon/issues/16822
# and https://github.com/mastodon/mastodon/issues/26394 # and https://github.com/mastodon/mastodon/issues/26394
if ENV['S3_FORCE_SINGLE_REQUEST'] == 'true' || ENV['S3_DISABLE_CHECKSUM_MODE'] == 'true'
module Paperclip module Paperclip
module Storage module Storage
module S3Extensions module S3Extensions
@ -100,7 +99,7 @@ if ENV['S3_ENABLED'] == 'true'
options = {} options = {}
options[:mode] = 'single_request' if ENV['S3_FORCE_SINGLE_REQUEST'] == 'true' options[:mode] = 'single_request' if ENV['S3_FORCE_SINGLE_REQUEST'] == 'true'
options[:checksum_mode] = 'DISABLED' if ENV['S3_DISABLE_CHECKSUM_MODE'] == 'true' options[:checksum_mode] = 'DISABLED' unless ENV['S3_ENABLE_CHECKSUM_MODE'] == 'true'
s3_object(style).download_file(local_dest_path, options) s3_object(style).download_file(local_dest_path, options)
rescue Aws::Errors::ServiceError => e rescue Aws::Errors::ServiceError => e
@ -112,7 +111,6 @@ if ENV['S3_ENABLED'] == 'true'
end end
Paperclip::Storage::S3.prepend(Paperclip::Storage::S3Extensions) Paperclip::Storage::S3.prepend(Paperclip::Storage::S3Extensions)
end
elsif ENV['SWIFT_ENABLED'] == 'true' elsif ENV['SWIFT_ENABLED'] == 'true'
require 'fog/openstack' require 'fog/openstack'