Class: Decidim::AttachmentUploader

Inherits:
ApplicationUploader show all
Includes:
CarrierWave::MiniMagick
Defined in:
app/uploaders/decidim/attachment_uploader.rb

Overview

This class deals with uploading attachments to a participatory space.

Instance Method Summary collapse

Methods inherited from ApplicationUploader

#skip_ssrf_protection?, #store_dir

Instance Method Details

#content_type_whitelistObject

CarrierWave automatically calls this method and validates the content type fo the temp file to match against any of these options.



31
32
33
34
35
36
37
38
# File 'app/uploaders/decidim/attachment_uploader.rb', line 31

def content_type_whitelist
  case upload_context
  when :admin
    Decidim.organization_settings(model).upload_allowed_content_types_admin
  else
    Decidim.organization_settings(model).upload_allowed_content_types
  end
end

#extension_whitelistObject



20
21
22
23
24
25
26
27
# File 'app/uploaders/decidim/attachment_uploader.rb', line 20

def extension_whitelist
  case upload_context
  when :admin
    Decidim.organization_settings(model).upload_allowed_file_extensions_admin
  else
    Decidim.organization_settings(model).upload_allowed_file_extensions
  end
end