Commit 9a15b112 authored by Alexis Reigel's avatar Alexis Reigel Committed by Rémy Coutable

Fixes the 500 for custom apearance header logo and logo

parent dda66953
......@@ -21,6 +21,8 @@ class UploadsController < ApplicationController
can?(current_user, :read_project, model.project)
when User
true
when Appearance
true
else
permission = "read_#{model.class.to_s.underscore}".to_sym
......
---
title: Fixes the 500 when accessing customized appearance logos
merge_request: 11479
author: Alexis Reigel
......@@ -473,5 +473,45 @@ describe UploadsController do
end
end
end
context 'Appearance' do
context 'when viewing a custom header logo' do
let!(:appearance) { create :appearance, header_logo: fixture_file_upload(Rails.root.join('spec/fixtures/dk.png'), 'image/png') }
context 'when not signed in' do
it 'responds with status 200' do
get :show, model: 'appearance', mounted_as: 'header_logo', id: appearance.id, filename: 'dk.png'
expect(response).to have_http_status(200)
end
it_behaves_like 'content not cached without revalidation' do
subject do
get :show, model: 'appearance', mounted_as: 'header_logo', id: appearance.id, filename: 'dk.png'
response
end
end
end
end
context 'when viewing a custom logo' do
let!(:appearance) { create :appearance, logo: fixture_file_upload(Rails.root.join('spec/fixtures/dk.png'), 'image/png') }
context 'when not signed in' do
it 'responds with status 200' do
get :show, model: 'appearance', mounted_as: 'logo', id: appearance.id, filename: 'dk.png'
expect(response).to have_http_status(200)
end
it_behaves_like 'content not cached without revalidation' do
subject do
get :show, model: 'appearance', mounted_as: 'logo', id: appearance.id, filename: 'dk.png'
response
end
end
end
end
end
end
end
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment