Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
G
gitlab-ce
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Léo-Paul Géneau
gitlab-ce
Commits
9a15b112
Commit
9a15b112
authored
May 19, 2017
by
Alexis Reigel
Committed by
Rémy Coutable
May 19, 2017
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fixes the 500 for custom apearance header logo and logo
parent
dda66953
Changes
3
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
46 additions
and
0 deletions
+46
-0
app/controllers/uploads_controller.rb
app/controllers/uploads_controller.rb
+2
-0
changelogs/unreleased/fix-allow-accessing-appearance-images.yml
...logs/unreleased/fix-allow-accessing-appearance-images.yml
+4
-0
spec/controllers/uploads_controller_spec.rb
spec/controllers/uploads_controller_spec.rb
+40
-0
No files found.
app/controllers/uploads_controller.rb
View file @
9a15b112
...
@@ -21,6 +21,8 @@ class UploadsController < ApplicationController
...
@@ -21,6 +21,8 @@ class UploadsController < ApplicationController
can?
(
current_user
,
:read_project
,
model
.
project
)
can?
(
current_user
,
:read_project
,
model
.
project
)
when
User
when
User
true
true
when
Appearance
true
else
else
permission
=
"read_
#{
model
.
class
.
to_s
.
underscore
}
"
.
to_sym
permission
=
"read_
#{
model
.
class
.
to_s
.
underscore
}
"
.
to_sym
...
...
changelogs/unreleased/fix-allow-accessing-appearance-images.yml
0 → 100644
View file @
9a15b112
---
title
:
Fixes the 500 when accessing customized appearance logos
merge_request
:
11479
author
:
Alexis Reigel
spec/controllers/uploads_controller_spec.rb
View file @
9a15b112
...
@@ -473,5 +473,45 @@ describe UploadsController do
...
@@ -473,5 +473,45 @@ describe UploadsController do
end
end
end
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
end
end
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment