fix(image processing): process only authorized image and pdf types

This commit is contained in:
Eric Leroy-Terquem 2024-10-24 11:50:41 +02:00
parent e6845cd94d
commit 4dc13cc56c
No known key found for this signature in database
GPG key ID: 53D8FAECEF207605
2 changed files with 4 additions and 1 deletions

View file

@ -20,6 +20,7 @@ module AttachmentImageProcessorConcern
return if blob.nil?
return if blob.attachments.size != 1
return if blob.attachments.last.record_type == "Export"
return if !blob.content_type.in?(PROCESSABLE_TYPES)
ImageProcessorJob.perform_later(blob)
end

View file

@ -21,7 +21,9 @@ RARE_IMAGE_TYPES = [
'image/tiff' # multimedia x 3985
]
AUTHORIZED_CONTENT_TYPES = AUTHORIZED_IMAGE_TYPES + AUTHORIZED_PDF_TYPES + [
PROCESSABLE_TYPES = AUTHORIZED_IMAGE_TYPES + AUTHORIZED_PDF_TYPES
AUTHORIZED_CONTENT_TYPES = PROCESSABLE_TYPES + [
# multimedia
'video/mp4', # multimedia x 2075
'video/quicktime', # multimedia x 486