2018-07-04 13:32:46 -04:00
|
|
|
# frozen_string_literal: true
|
|
|
|
|
2017-09-26 03:51:24 -04:00
|
|
|
class FaviconUploader < AttachmentUploader
|
2022-08-05 05:12:06 -04:00
|
|
|
EXTENSION_ALLOWLIST = %w[png ico].freeze
|
|
|
|
MIME_ALLOWLIST = %w[image/png image/vnd.microsoft.icon].freeze
|
2020-01-02 16:07:38 -05:00
|
|
|
|
2017-09-27 09:03:49 -04:00
|
|
|
def extension_whitelist
|
2022-08-05 05:12:06 -04:00
|
|
|
EXTENSION_ALLOWLIST
|
2017-09-27 09:03:49 -04:00
|
|
|
end
|
|
|
|
|
2020-03-12 14:09:28 -04:00
|
|
|
def content_type_whitelist
|
2022-08-05 05:12:06 -04:00
|
|
|
MIME_ALLOWLIST
|
2020-03-12 14:09:28 -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
|