diff options
-rw-r--r-- | app/helpers/favicon_helper.rb | 7 | ||||
-rw-r--r-- | app/uploaders/favicon_uploader.rb | 4 | ||||
-rw-r--r-- | app/views/admin/appearances/_form.html.haml | 4 |
3 files changed, 13 insertions, 2 deletions
diff --git a/app/helpers/favicon_helper.rb b/app/helpers/favicon_helper.rb new file mode 100644 index 00000000000..3a5342a8d9d --- /dev/null +++ b/app/helpers/favicon_helper.rb @@ -0,0 +1,7 @@ +module FaviconHelper + def favicon_extension_whitelist + FaviconUploader::EXTENSION_WHITELIST + .map { |extension| "'.#{extension}'"} + .to_sentence + end +end diff --git a/app/uploaders/favicon_uploader.rb b/app/uploaders/favicon_uploader.rb index aa4c78da7a6..09afc63a5aa 100644 --- a/app/uploaders/favicon_uploader.rb +++ b/app/uploaders/favicon_uploader.rb @@ -1,4 +1,6 @@ class FaviconUploader < AttachmentUploader + EXTENSION_WHITELIST = %w[png ico].freeze + include CarrierWave::MiniMagick version :favicon_main do @@ -11,7 +13,7 @@ class FaviconUploader < AttachmentUploader end def extension_whitelist - %w[png ico] + EXTENSION_WHITELIST end private diff --git a/app/views/admin/appearances/_form.html.haml b/app/views/admin/appearances/_form.html.haml index 81979f7b331..ac92b043074 100644 --- a/app/views/admin/appearances/_form.html.haml +++ b/app/views/admin/appearances/_form.html.haml @@ -70,7 +70,9 @@ = f.hidden_field :favicon_cache = f.file_field :favicon, class: '' .hint - Maximum file size is 1MB. The resulting favicons will be cropped to be square and scaled down to a size of 32x32 px. + Maximum file size is 1MB. Allowed image formats are #{favicon_extension_whitelist}. + %br + The resulting favicons will be cropped to be square and scaled down to a size of 32x32 px. .form-actions = f.submit 'Save', class: 'btn btn-save append-right-10' |