Class: LighthouseDocumentUploaderBase

Inherits:
CarrierWave::Uploader::Base
  • Object
show all
Includes:
CarrierWave::MiniMagick, ConvertFileType, SetAWSConfig, UploaderVirusScan, ValidatePdf
Defined in:
app/uploaders/lighthouse_document_uploader_base.rb

Direct Known Subclasses

LighthouseDocumentUploader

Instance Method Summary collapse

Methods included from UploaderVirusScan

#validate_virus_free

Methods included from ConvertFileType

#converted_exists?, #final_filename, #read_for_upload, #tiff?, #tiff_or_incorrect_extension?

Methods included from ValidatePdf

#validate, #validate_pdf

Methods included from SetAWSConfig

#set_aws_config

Instance Method Details

#extension_allowlistObject



30
31
32
# File 'app/uploaders/lighthouse_document_uploader_base.rb', line 30

def extension_allowlist
  %w[pdf gif png tiff tif jpeg jpg bmp txt]
end

#max_file_size_non_pdfObject



34
35
36
# File 'app/uploaders/lighthouse_document_uploader_base.rb', line 34

def max_file_size_non_pdf
  50.megabytes
end

#size_rangeObject



26
27
28
# File 'app/uploaders/lighthouse_document_uploader_base.rb', line 26

def size_range
  (1.byte)...(150.megabytes)
end

#validate_file_size(file) ⇒ Object

Lighthouse will split PDF’s larger than 50mb before sending to VBA who has a limit of 50mb. so, PDF’s can be larger than other files



40
41
42
43
44
45
# File 'app/uploaders/lighthouse_document_uploader_base.rb', line 40

def validate_file_size(file)
  if file.content_type != 'application/pdf' && file.size > max_file_size_non_pdf
    raise CarrierWave::IntegrityError, I18n.t(:'errors.messages.max_size_error',
                                              max_size: '50MB')
  end
end