2018-11-08 19:23:39 +05:30
|
|
|
# frozen_string_literal: true
|
|
|
|
|
|
|
|
class FaviconUploader < AttachmentUploader
|
2022-08-27 11:52:29 +05:30
|
|
|
EXTENSION_ALLOWLIST = %w[png ico].freeze
|
|
|
|
MIME_ALLOWLIST = %w[image/png image/vnd.microsoft.icon].freeze
|
2020-03-13 15:44:24 +05:30
|
|
|
|
2018-11-08 19:23:39 +05:30
|
|
|
def extension_whitelist
|
2022-08-27 11:52:29 +05:30
|
|
|
EXTENSION_ALLOWLIST
|
2018-11-08 19:23:39 +05:30
|
|
|
end
|
|
|
|
|
2020-04-08 14:13:33 +05:30
|
|
|
def content_type_whitelist
|
2022-08-27 11:52:29 +05:30
|
|
|
MIME_ALLOWLIST
|
2020-04-08 14:13:33 +05:30
|
|
|
end
|
|
|
|
|
2018-11-08 19:23:39 +05:30
|
|
|
private
|
|
|
|
|
|
|
|
def filename_for_different_format(filename, format)
|
|
|
|
filename.chomp(File.extname(filename)) + ".#{format}"
|
|
|
|
end
|
|
|
|
end
|