summaryrefslogtreecommitdiff
path: root/app/uploaders/favicon_uploader.rb
blob: c9be55e001ca111b3d3442d04b2683e0b5feec9c (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
# 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