Merge pull request #10984 from demarches-simplifiees/fix-image-processor-job-errors

Technique : gestion des cas d'erreurs de ImageProcessorJob
This commit is contained in:
LeSim 2024-10-30 14:43:43 +00:00 committed by GitHub
commit 0e589fc7ad
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
3 changed files with 6 additions and 2 deletions

View file

@ -18,8 +18,9 @@ module AttachmentImageProcessorConcern
def process_image def process_image
return if blob.nil? return if blob.nil?
return if blob.attachments.size > 1 return if blob.attachments.size != 1
return if blob.attachments.last.record_type == "Export" return if blob.attachments.last.record_type == "Export"
return if !blob.content_type.in?(PROCESSABLE_TYPES)
ImageProcessorJob.perform_later(blob) ImageProcessorJob.perform_later(blob)
end end

View file

@ -17,6 +17,7 @@ class UninterlaceService
end end
def interlaced?(png_path) def interlaced?(png_path)
return false if png_path.blank?
png = MiniMagick::Image.open(png_path) png = MiniMagick::Image.open(png_path)
png.data["interlace"] != "None" png.data["interlace"] != "None"
end end

View file

@ -21,7 +21,9 @@ RARE_IMAGE_TYPES = [
'image/tiff' # multimedia x 3985 '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 # multimedia
'video/mp4', # multimedia x 2075 'video/mp4', # multimedia x 2075
'video/quicktime', # multimedia x 486 'video/quicktime', # multimedia x 486