debian-mirror-gitlab/app/uploaders/favicon_uploader.rb
2020-04-08 18:37:08 +05:30

20 lines
428 B
Ruby

# frozen_string_literal: true
class FaviconUploader < AttachmentUploader
EXTENSION_WHITELIST = %w[png ico].freeze
MIME_WHITELIST = %w[image/png image/vnd.microsoft.icon].freeze
def extension_whitelist
EXTENSION_WHITELIST
end
def content_type_whitelist
MIME_WHITELIST
end
private
def filename_for_different_format(filename, format)
filename.chomp(File.extname(filename)) + ".#{format}"
end
end