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
85a8e6f2
Commit
85a8e6f2
authored
Sep 27, 2017
by
Alexis Reigel
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
whitelist allowed file types for custom favicons
parent
822023c6
Changes
3
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
24 additions
and
0 deletions
+24
-0
app/uploaders/favicon_uploader.rb
app/uploaders/favicon_uploader.rb
+4
-0
config/locales/carrierwave.en.yml
config/locales/carrierwave.en.yml
+14
-0
spec/features/admin/admin_appearance_spec.rb
spec/features/admin/admin_appearance_spec.rb
+6
-0
No files found.
app/uploaders/favicon_uploader.rb
View file @
85a8e6f2
...
...
@@ -33,6 +33,10 @@ class FaviconUploader < AttachmentUploader
end
end
def
extension_whitelist
UploaderHelper
::
IMAGE_EXT
end
private
def
status_favicon
(
status_name
)
...
...
config/locales/carrierwave.en.yml
0 → 100644
View file @
85a8e6f2
en
:
errors
:
messages
:
carrierwave_processing_error
:
failed to be processed
carrierwave_integrity_error
:
is not of an allowed file type
carrierwave_download_error
:
could not be downloaded
extension_whitelist_error
:
"
You
are
not
allowed
to
upload
%{extension}
files,
allowed
types:
%{allowed_types}"
extension_blacklist_error
:
"
You
are
not
allowed
to
upload
%{extension}
files,
prohibited
types:
%{prohibited_types}"
content_type_whitelist_error
:
"
You
are
not
allowed
to
upload
%{content_type}
files"
content_type_blacklist_error
:
"
You
are
not
allowed
to
upload
%{content_type}
files"
rmagick_processing_error
:
"
Failed
to
manipulate
with
rmagick,
maybe
it
is
not
an
image?"
mini_magick_processing_error
:
"
Failed
to
manipulate
with
MiniMagick,
maybe
it
is
not
an
image?
Original
Error:
%{e}"
min_size_error
:
"
File
size
should
be
greater
than
%{min_size}"
max_size_error
:
"
File
size
should
be
less
than
%{max_size}"
spec/features/admin/admin_appearance_spec.rb
View file @
85a8e6f2
...
...
@@ -108,6 +108,12 @@ feature 'Admin Appearance' do
expect
(
page
).
not_to
have_css
(
'//img[data-src$="/status_skipped_dk.ico"]'
)
expect
(
page
).
not_to
have_css
(
'//img[data-src$="/status_success_dk.ico"]'
)
expect
(
page
).
not_to
have_css
(
'//img[data-src$="/status_warning_dk.ico"]'
)
# allowed file types
attach_file
(
:appearance_favicon
,
Rails
.
root
.
join
(
'spec'
,
'fixtures'
,
'sanitized.svg'
))
click_button
'Save'
expect
(
page
).
to
have_content
'Favicon You are not allowed to upload "svg" files, allowed types: png, jpg, jpeg, gif, bmp, tiff, ico'
end
def
expect_custom_sign_in_appearance
(
appearance
)
...
...
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