diff options
author | Stan Hu <stanhu@gmail.com> | 2019-02-13 10:46:14 -0800 |
---|---|---|
committer | Stan Hu <stanhu@gmail.com> | 2019-02-13 11:09:52 -0800 |
commit | 134420f2eff904f9e40165751fcd8700b0770157 (patch) | |
tree | fe949bc731e00567c144f445409a09601a53b1d1 /spec/controllers/concerns | |
parent | c470a77937c79169f3ba78a31c249bd71b5c6070 (diff) | |
download | gitlab-ce-134420f2eff904f9e40165751fcd8700b0770157.tar.gz |
Fix Content-Disposition hard-coded to attachments
Due to a regression in
https://gitlab.com/gitlab-org/gitlab-ce/merge_requests/24919,
Content-Disposition is hard-coded to `attachment` instead of `inline`.
We now use the argument `disposition` to fix that problem.
Closes https://gitlab.com/gitlab-org/gitlab-ce/issues/57660
Diffstat (limited to 'spec/controllers/concerns')
-rw-r--r-- | spec/controllers/concerns/send_file_upload_spec.rb | 17 |
1 files changed, 17 insertions, 0 deletions
diff --git a/spec/controllers/concerns/send_file_upload_spec.rb b/spec/controllers/concerns/send_file_upload_spec.rb index a07113a6156..cf3b24f50a3 100644 --- a/spec/controllers/concerns/send_file_upload_spec.rb +++ b/spec/controllers/concerns/send_file_upload_spec.rb @@ -52,6 +52,23 @@ describe SendFileUpload do end end + context 'with inline image' do + let(:filename) { 'test.png' } + let(:params) { { disposition: 'inline', attachment: filename } } + + it 'sends a file with inline disposition' do + # Notice the filename= is omitted from the disposition; this is because + # Rails 5 will append this header in send_file + expected_params = { + filename: 'test.png', + disposition: "inline; filename*=UTF-8''test.png" + } + expect(controller).to receive(:send_file).with(uploader.path, expected_params) + + subject + end + end + context 'with attachment' do let(:filename) { 'test.js' } let(:params) { { attachment: filename } } |