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:
commit
0e589fc7ad
3 changed files with 6 additions and 2 deletions
|
@ -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
|
||||||
|
|
|
@ -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
|
||||||
|
|
|
@ -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
|
||||||
|
|
Loading…
Reference in a new issue