Commit 244ed8ad authored by Stan Hu's avatar Stan Hu

Fix object storage uploads not working with AWS v2

Because we were passing query strings as symbols, the fog-aws storage
driver was omitting the uploadId and partNumber query strings
from the signature in multipart uploads. This fix makes AWS and Ceph work with
v2 signatures.

See: https://github.com/fog/fog-aws/blob/v3.0.0/lib/fog/aws/storage.rb#L733

Closes https://gitlab.com/gitlab-org/gitlab-workhorse/issues/181
parent 32b96bfd
---
title: Fix object storage uploads not working with AWS v2
merge_request: 21731
author:
type: fixed
......@@ -89,7 +89,7 @@ module ObjectStorage
method: 'PUT',
bucket_name: bucket_name,
object_name: object_name,
query: { uploadId: upload_id, partNumber: part_number },
query: { 'uploadId' => upload_id, 'partNumber' => part_number },
headers: upload_options
}, expire_at)
end
......@@ -100,7 +100,7 @@ module ObjectStorage
method: 'POST',
bucket_name: bucket_name,
object_name: object_name,
query: { uploadId: upload_id },
query: { 'uploadId' => upload_id },
headers: { 'Content-Type' => 'application/xml' }
}, expire_at)
end
......@@ -111,7 +111,7 @@ module ObjectStorage
method: 'DELETE',
bucket_name: bucket_name,
object_name: object_name,
query: { uploadId: upload_id }
query: { 'uploadId' => upload_id }
}, expire_at)
end
......
......@@ -83,6 +83,16 @@ describe ObjectStorage::DirectUpload do
expect(subject[:MultipartUpload][:AbortURL]).to start_with(storage_url)
expect(subject[:MultipartUpload][:AbortURL]).to include('uploadId=myUpload')
end
it 'uses only strings in query parameters' do
expect(direct_upload.send(:connection)).to receive(:signed_url).at_least(:once) do |params|
if params[:query]
expect(params[:query].keys.all? { |key| key.is_a?(String) }).to be_truthy
end
end
subject
end
end
shared_examples 'a valid upload without multipart data' do
......
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