Skip to content
代码片段 群组 项目
未验证 提交 034334d1 编辑于 作者: Dzmitry Meshcharakou's avatar Dzmitry Meshcharakou 提交者: GitLab
浏览文件
No related branches found
No related tags found
无相关合并请求
...@@ -19,7 +19,7 @@ def url(*args, **kwargs) ...@@ -19,7 +19,7 @@ def url(*args, **kwargs)
'x-goog-custom-audit-gitlab-size-bytes' => model.try(:size) || size 'x-goog-custom-audit-gitlab-size-bytes' => model.try(:size) || size
}.compact.transform_values(&:to_s) }.compact.transform_values(&:to_s)
super(*args, **kwargs.merge(query: metadata_params)) super(*args, **kwargs.deep_merge(query: metadata_params))
rescue StandardError => e rescue StandardError => e
Gitlab::ErrorTracking.track_exception( Gitlab::ErrorTracking.track_exception(
e, e,
......
...@@ -25,6 +25,36 @@ ...@@ -25,6 +25,36 @@
.to eq(%(attachment; filename="#{filename}"; filename*=UTF-8''#{filename})) .to eq(%(attachment; filename="#{filename}"; filename*=UTF-8''#{filename}))
end 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 context 'when file name has directory structure' do
let(:filename) { 'dir%2Ffile.zip' } let(:filename) { 'dir%2Ffile.zip' }
......
0% 加载中 .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册