1
0
Fork 0
mirror of https://github.com/fog/fog-aws.git synced 2022-11-09 13:50:52 -05:00

(Automatically) set multipart chunk size if the file is too big for a single PUT operation and mp was not set.

This commit is contained in:
Brett Cave 2016-07-30 07:53:46 +02:00
parent 0f5ff953ba
commit 46a92c05b2
No known key found for this signature in database
GPG key ID: C03499DC0E9CA275

View file

@ -209,6 +209,9 @@ module Fog
options['x-amz-storage-class'] = storage_class if storage_class
options.merge!(encryption_headers)
# With a single PUT operation you can upload objects up to 5 GB in size. Automatically set MP for larger objects.
multipart_chunk_size=5242880 if !multipart_chunk_size && Fog::Storage.get_body_size(body) > 5368709120
if multipart_chunk_size && Fog::Storage.get_body_size(body) >= multipart_chunk_size && body.respond_to?(:read)
data = multipart_save(options)
merge_attributes(data.body)