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