Skip to content
代码片段 群组 项目
未验证 提交 822f7559 编辑于 作者: David Fernandez's avatar David Fernandez 提交者: GitLab
浏览文件

Fix an overwrite bug in the gcs metrics concern

When writing the gcs signed url metrics don't overwrite the existing
value if there is one. Now, we're going to merge the metrics into the
existing value.

Changelog: fixed
上级 ed56bb01
加载中
......@@ -19,7 +19,7 @@ def url(*args, **kwargs)
'x-goog-custom-audit-gitlab-size-bytes' => model.try(:size) || size
}.compact.transform_values(&:to_s)
super(*args, **kwargs.merge(query: metadata_params))
super(*args, **kwargs.deep_merge(query: metadata_params))
rescue StandardError => e
Gitlab::ErrorTracking.track_exception(
e,
......
......@@ -25,6 +25,36 @@
.to eq(%(attachment; filename="#{filename}"; filename*=UTF-8''#{filename}))
end
context 'when the fog provider is Google and on .com', :saas do
let(:package_file) { create(:package_file, :object_storage, package: package, file_name: filename) }
before do
stub_package_file_object_storage(
config: Gitlab.config.packages.object_store.merge(connection: {
provider: 'Google',
google_storage_access_key_id: 'test-access-id',
google_storage_secret_access_key: 'secret'
}),
proxy_download: true
)
end
it 'send the correct headers' do
subject
command, encoded_params = response.headers[::Gitlab::Workhorse::SEND_DATA_HEADER].split(':')
params = Gitlab::Json.parse(Base64.urlsafe_decode64(encoded_params))
expect(command).to eq('send-url')
expect(params['URL']).to include(
%(response-content-disposition=attachment%3B%20filename%3D%22#{filename}),
'x-goog-custom-audit-gitlab-project',
'x-goog-custom-audit-gitlab-namespace',
'x-goog-custom-audit-gitlab-size-bytes'
)
end
end
context 'when file name has directory structure' do
let(:filename) { 'dir%2Ffile.zip' }
......
0% 加载中 .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册