Commit bc49373b authored by Stan Hu's avatar Stan Hu

Fix UTF-8 characters not working with Azure Blob storage

This pulls in the changes in
https://gitlab.com/gitlab-org/gitlab-fog-azure-rm/-/merge_requests/21 to
force Azure to encode generated URLs.

Closes https://gitlab.com/gitlab-org/gitlab/-/issues/296736
parent 77021f04
......@@ -122,7 +122,7 @@ gem 'fog-local', '~> 0.6'
gem 'fog-openstack', '~> 1.0'
gem 'fog-rackspace', '~> 0.1.1'
gem 'fog-aliyun', '~> 0.3'
gem 'gitlab-fog-azure-rm', '~> 1.0', require: false
gem 'gitlab-fog-azure-rm', '~> 1.0.1', require: false
# for Google storage
gem 'google-api-client', '~> 0.33'
......
......@@ -428,7 +428,7 @@ GEM
gitlab-experiment (0.4.12)
activesupport (>= 3.0)
scientist (~> 1.5, >= 1.5.0)
gitlab-fog-azure-rm (1.0.0)
gitlab-fog-azure-rm (1.0.1)
azure-storage-blob (~> 2.0)
azure-storage-common (~> 2.0)
fog-core (= 2.1.0)
......@@ -737,7 +737,7 @@ GEM
mustermann (>= 1.0.0)
nap (1.1.0)
nenv (0.3.0)
net-http-persistent (4.0.0)
net-http-persistent (4.0.1)
connection_pool (~> 2.2)
net-ldap (0.16.3)
net-ntp (2.1.3)
......@@ -1372,7 +1372,7 @@ DEPENDENCIES
github-markup (~> 1.7.0)
gitlab-chronic (~> 0.10.5)
gitlab-experiment (~> 0.4.12)
gitlab-fog-azure-rm (~> 1.0)
gitlab-fog-azure-rm (~> 1.0.1)
gitlab-labkit (= 0.14.0)
gitlab-license (~> 1.3)
gitlab-mail_room (~> 0.0.8)
......
---
title: Fix UTF-8 characters not working with Azure Blob storage
merge_request: 54875
author:
type: fixed
......@@ -224,6 +224,17 @@ RSpec.describe ObjectStorage::DirectUpload do
expect(subject[:CustomPutHeaders]).to be_truthy
expect(subject[:PutHeaders]).to eq({})
end
context 'with an object with UTF-8 characters' do
let(:object_name) { 'tmp/uploads/テスト' }
it 'returns an escaped path' do
expect(subject[:GetURL]).to start_with(storage_url)
uri = Addressable::URI.parse(subject[:GetURL])
expect(uri.path).to include("tmp/uploads/#{CGI.escape("テスト")}")
end
end
end
shared_examples 'a valid upload with multipart data' do
......
......@@ -114,7 +114,7 @@ module StubObjectStorage
end
def stub_object_storage_multipart_init(endpoint, upload_id = "upload_id")
stub_request(:post, %r{\A#{endpoint}tmp/uploads/[a-z0-9-]*\?uploads\z})
stub_request(:post, %r{\A#{endpoint}tmp/uploads/[%A-Za-z0-9-]*\?uploads\z})
.to_return status: 200, body: <<-EOS.strip_heredoc
<?xml version="1.0" encoding="UTF-8"?>
<InitiateMultipartUploadResult xmlns="http://s3.amazonaws.com/doc/2006-03-01/">
......
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