Commit 877c8889 authored by Nick Thomas's avatar Nick Thomas

Merge branch 'sh-fix-multipart-upload-signed-urls' into 'master'

Fix object storage uploads not working with AWS v2

Closes gitlab-workhorse#181

See merge request gitlab-org/gitlab-ce!21731
parents abdb0d36 244ed8ad
---
title: Fix object storage uploads not working with AWS v2
merge_request: 21731
author:
type: fixed
...@@ -89,7 +89,7 @@ module ObjectStorage ...@@ -89,7 +89,7 @@ module ObjectStorage
method: 'PUT', method: 'PUT',
bucket_name: bucket_name, bucket_name: bucket_name,
object_name: object_name, object_name: object_name,
query: { uploadId: upload_id, partNumber: part_number }, query: { 'uploadId' => upload_id, 'partNumber' => part_number },
headers: upload_options headers: upload_options
}, expire_at) }, expire_at)
end end
...@@ -100,7 +100,7 @@ module ObjectStorage ...@@ -100,7 +100,7 @@ module ObjectStorage
method: 'POST', method: 'POST',
bucket_name: bucket_name, bucket_name: bucket_name,
object_name: object_name, object_name: object_name,
query: { uploadId: upload_id }, query: { 'uploadId' => upload_id },
headers: { 'Content-Type' => 'application/xml' } headers: { 'Content-Type' => 'application/xml' }
}, expire_at) }, expire_at)
end end
...@@ -111,7 +111,7 @@ module ObjectStorage ...@@ -111,7 +111,7 @@ module ObjectStorage
method: 'DELETE', method: 'DELETE',
bucket_name: bucket_name, bucket_name: bucket_name,
object_name: object_name, object_name: object_name,
query: { uploadId: upload_id } query: { 'uploadId' => upload_id }
}, expire_at) }, expire_at)
end end
......
...@@ -83,6 +83,16 @@ describe ObjectStorage::DirectUpload do ...@@ -83,6 +83,16 @@ describe ObjectStorage::DirectUpload do
expect(subject[:MultipartUpload][:AbortURL]).to start_with(storage_url) expect(subject[:MultipartUpload][:AbortURL]).to start_with(storage_url)
expect(subject[:MultipartUpload][:AbortURL]).to include('uploadId=myUpload') expect(subject[:MultipartUpload][:AbortURL]).to include('uploadId=myUpload')
end 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 end
shared_examples 'a valid upload without multipart data' do 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