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