diff options
author | Simon Knox <psimyn@gmail.com> | 2017-02-16 13:10:32 +1100 |
---|---|---|
committer | Simon Knox <psimyn@gmail.com> | 2017-02-16 13:10:32 +1100 |
commit | 8a928af0fc54a84c5b858955e7459512155d4af0 (patch) | |
tree | 4c55ff6c1cd20405e9adf5973e2ce1c229fcebde /spec/controllers | |
parent | 3f713db0da2602152aa482b57f84b7418fd20a93 (diff) | |
parent | b05e75b8faccc50749adc63419074c91802a8f50 (diff) | |
download | gitlab-ce-task_list_refactor.tar.gz |
Merge branch 'master' of gitlab.com:gitlab-org/gitlab-ce into task_list_refactortask_list_refactor
Diffstat (limited to 'spec/controllers')
-rw-r--r-- | spec/controllers/uploads_controller_spec.rb | 22 |
1 files changed, 22 insertions, 0 deletions
diff --git a/spec/controllers/uploads_controller_spec.rb b/spec/controllers/uploads_controller_spec.rb index 570d9fa43f8..c9584ddf18c 100644 --- a/spec/controllers/uploads_controller_spec.rb +++ b/spec/controllers/uploads_controller_spec.rb @@ -4,6 +4,28 @@ describe UploadsController do let!(:user) { create(:user, avatar: fixture_file_upload(Rails.root + "spec/fixtures/dk.png", "image/png")) } describe "GET show" do + context 'Content-Disposition security measures' do + let(:project) { create(:empty_project, :public) } + + context 'for PNG files' do + it 'returns Content-Disposition: inline' do + note = create(:note, :with_attachment, project: project) + get :show, model: 'note', mounted_as: 'attachment', id: note.id, filename: 'image.png' + + expect(response['Content-Disposition']).to start_with('inline;') + end + end + + context 'for SVG files' do + it 'returns Content-Disposition: attachment' do + note = create(:note, :with_svg_attachment, project: project) + get :show, model: 'note', mounted_as: 'attachment', id: note.id, filename: 'image.svg' + + expect(response['Content-Disposition']).to start_with('attachment;') + end + end + end + context "when viewing a user avatar" do context "when signed in" do before do |