diff options
author | Rémy Coutable <remy@rymai.me> | 2018-05-14 17:55:19 +0300 |
---|---|---|
committer | Rémy Coutable <remy@rymai.me> | 2018-05-14 17:55:19 +0300 |
commit | f805546f98dcfd5fd8e3da890ff4f23ff8de1a66 (patch) | |
tree | 64d3af7475a8f015c04853dc1af577ceeda57af5 /spec | |
parent | ca9bce4aa1a7b40616f83c9f2cd5ed452e253001 (diff) | |
parent | 0c43170630b5b4e90e8f91526066435a06e077eb (diff) |
Merge branch 'sh-fix-cross-site-origin-uploads-js' into 'master'
Fix cross-origin errors when attempting to download JavaScript attachments
Closes #45826
See merge request gitlab-org/gitlab-ce!18936
Diffstat (limited to 'spec')
-rw-r--r-- | spec/controllers/concerns/send_file_upload_spec.rb | 15 |
1 files changed, 15 insertions, 0 deletions
diff --git a/spec/controllers/concerns/send_file_upload_spec.rb b/spec/controllers/concerns/send_file_upload_spec.rb index f4c99ea4064..58bb91a0c80 100644 --- a/spec/controllers/concerns/send_file_upload_spec.rb +++ b/spec/controllers/concerns/send_file_upload_spec.rb @@ -51,6 +51,21 @@ describe SendFileUpload do end end + context 'with attachment' do + subject { controller.send_upload(uploader, attachment: 'test.js') } + + it 'sends a file with content-type of text/plain' do + expected_params = { + content_type: 'text/plain', + filename: 'test.js', + disposition: 'attachment' + } + expect(controller).to receive(:send_file).with(uploader.path, expected_params) + + subject + end + end + context 'when remote file is used' do before do stub_uploads_object_storage(uploader: uploader_class) |