diff options
Diffstat (limited to 'lib/object_storage')
-rw-r--r-- | lib/object_storage/config.rb | 5 | ||||
-rw-r--r-- | lib/object_storage/direct_upload.rb | 9 |
2 files changed, 12 insertions, 2 deletions
diff --git a/lib/object_storage/config.rb b/lib/object_storage/config.rb index cc536ce9b46..f933d4e4866 100644 --- a/lib/object_storage/config.rb +++ b/lib/object_storage/config.rb @@ -93,6 +93,11 @@ module ObjectStorage private + # This returns a Hash of HTTP encryption headers to send along to S3. + # + # They can also be passed in as Fog::AWS::Storage::File attributes, since there + # are aliases defined for them: + # https://github.com/fog/fog-aws/blob/ab288f29a0974d64fd8290db41080e5578be9651/lib/fog/aws/models/storage/file.rb#L24-L25 def aws_server_side_encryption_headers { 'x-amz-server-side-encryption' => server_side_encryption, diff --git a/lib/object_storage/direct_upload.rb b/lib/object_storage/direct_upload.rb index b5864382299..3a8fa51e198 100644 --- a/lib/object_storage/direct_upload.rb +++ b/lib/object_storage/direct_upload.rb @@ -184,15 +184,20 @@ module ObjectStorage private def rounded_multipart_part_size - # round multipart_part_size up to minimum_mulitpart_size + # round multipart_part_size up to minimum_multipart_size (multipart_part_size + MINIMUM_MULTIPART_SIZE - 1) / MINIMUM_MULTIPART_SIZE * MINIMUM_MULTIPART_SIZE end def multipart_part_size + return MINIMUM_MULTIPART_SIZE if maximum_size == 0 + maximum_size / number_of_multipart_parts end def number_of_multipart_parts + # If we don't have max length, we can only assume the file is as large as possible. + return MAXIMUM_MULTIPART_PARTS if maximum_size == 0 + [ # round maximum_size up to minimum_mulitpart_size (maximum_size + MINIMUM_MULTIPART_SIZE - 1) / MINIMUM_MULTIPART_SIZE, @@ -201,7 +206,7 @@ module ObjectStorage end def requires_multipart_upload? - config.aws? && !has_length + config.aws? && !has_length && !use_workhorse_s3_client? end def upload_id |