Commit 27c27b46 authored by Stan Hu's avatar Stan Hu

Require multipart URLs even if limit is size

AWS will complain if no Content-Length is not specified, so we need to
use multipart URLs if no length is available.
parent f3cd8027
...@@ -206,11 +206,7 @@ module ObjectStorage ...@@ -206,11 +206,7 @@ module ObjectStorage
end end
def requires_multipart_upload? def requires_multipart_upload?
config.aws? && !has_length && can_use_multipart_upload? && !use_workhorse_s3_client? config.aws? && !has_length && !use_workhorse_s3_client?
end
def can_use_multipart_upload?
(maximum_size == 0) || (maximum_size > MINIMUM_MULTIPART_SIZE)
end end
def upload_id def upload_id
......
...@@ -359,8 +359,12 @@ RSpec.describe ObjectStorage::DirectUpload do ...@@ -359,8 +359,12 @@ RSpec.describe ObjectStorage::DirectUpload do
context 'when maximum upload size is < 5 MB' do context 'when maximum upload size is < 5 MB' do
let(:maximum_size) { 1024 } let(:maximum_size) { 1024 }
it 'does not include multipart URLs' do it 'returns only 1 part' do
expect(subject).not_to include(:MultipartUpload) expect(subject[:MultipartUpload][:PartURLs].length).to eq(1)
end
it 'part size is minimum, 5MB' do
expect(subject[:MultipartUpload][:PartSize]).to eq(5.megabyte)
end end
end end
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment