2018-07-04 17:32:46 +00:00
|
|
|
# frozen_string_literal: true
|
|
|
|
|
2017-09-26 07:51:24 +00:00
|
|
|
class FaviconUploader < AttachmentUploader
|
2020-01-02 21:07:38 +00:00
|
|
|
include UploadTypeCheck::Concern
|
|
|
|
|
2018-05-17 17:00:32 +00:00
|
|
|
EXTENSION_WHITELIST = %w[png ico].freeze
|
|
|
|
|
2020-01-02 21:07:38 +00:00
|
|
|
check_upload_type extensions: EXTENSION_WHITELIST
|
|
|
|
|
2017-09-27 13:03:49 +00:00
|
|
|
def extension_whitelist
|
2018-05-17 17:00:32 +00:00
|
|
|
EXTENSION_WHITELIST
|
2017-09-27 13:03:49 +00:00
|
|
|
end
|
|
|
|
|
2017-09-26 13:02:00 +00:00
|
|
|
private
|
|
|
|
|
|
|
|
def filename_for_different_format(filename, format)
|
|
|
|
filename.chomp(File.extname(filename)) + ".#{format}"
|
|
|
|
end
|
2017-09-26 07:51:24 +00:00
|
|
|
end
|