Class: Decidim::AttachmentUploader

Inherits:
ApplicationUploader show all
Defined in:
decidim-core/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

#downloader, #manipulate!, #provider, #store_dir

Instance Method Details

#content_type_allowlistObject

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


29
30
31
32
33
34
35
36
# File 'decidim-core/app/uploaders/decidim/attachment_uploader.rb', line 29

def content_type_allowlist
  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_allowlistObject


18
19
20
21
22
23
24
25
# File 'decidim-core/app/uploaders/decidim/attachment_uploader.rb', line 18

def extension_allowlist
  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