Module: CarrierWave::Uploader::ContentTypeBlacklist

Extended by:
ActiveSupport::Concern
Included in:
Base
Defined in:
lib/carrierwave/uploader/content_type_blacklist.rb

Instance Method Summary collapse

Instance Method Details

#content_type_denylistObject

Override this method in your uploader to provide a denylist of files content types which are not allowed to be uploaded. Not only strings but Regexp are allowed as well.

Returns

NilClass, String, Regexp, Array[String, Regexp]

a denylist of content types which are not allowed to be uploaded

Examples

def content_type_denylist
  %w(text/json application/json)
end

Basically the same, but using a Regexp:

def content_type_denylist
  [/(text|application)\/json/]
end


31
32
33
34
35
36
37
# File 'lib/carrierwave/uploader/content_type_blacklist.rb', line 31

def content_type_denylist
  if respond_to?(:content_type_blacklist)
    ActiveSupport::Deprecation.warn "#content_type_blacklist is deprecated, use #content_type_denylist instead." unless instance_variable_defined?(:@content_type_blacklist_warned)
    @content_type_blacklist_warned = true
    content_type_blacklist
  end
end