CQ5.4: Files uploaded to DAM saved with incorrect mime-type


If you are uploading specific types of files (Word, PPT, SWF….) to CQ5 DAM, you may notice the the files are saved to the repository with a different mime-type, for example as images.

You may also notice warnings and errors in the error.log similar to the following:

*WARN* [JobHandler: /etc/workflow/instances/2012-06-20/model_171459455015372:/content/dam/geometrixx/documents/slides.ppt/jcr:content/renditions/original] com.day.cq.dam.commons.handler.StandardImageHandler extractImageInfo: error while reading metadata from image [/content/dam/geometrixx/documents/slides.ppt]:  org.apache.sanselan.ImageReadException: Can’t parse this format.
    at org.apache.sanselan.Sanselan.getImageParser(Sanselan.java:621)
    at org.apache.sanselan.Sanselan.getImageInfo(Sanselan.java:587)
    at org.apache.sanselan.Sanselan.getImageInfo(Sanselan.java:479)
    at com.day.cq.dam.commons.handler.StandardImageHandler.extractImageInfo(StandardImageHandler.java:207)
    at com.day.cq.dam.commons.handler.StandardImageHandler.extractMetadata(StandardImageHandler.java:244)
    at com.day.cq.dam.commons.handler.StandardImageHandler.extractMetadata(StandardImageHandler.java:145)
    at com.day.cq.dam.core.process.ExtractMetadataProcess.execute(ExtractMetadataProcess.java:65)

*ERROR* [JobHandler: /etc/workflow/instances/2012-06-20/model_171459455015372:/content/dam/geometrixx/documents/slides.ppt/jcr:content/renditions/original] com.day.cq.dam.core.impl.cache.CQBufferedImageCache Error while loading image /content/dam/geometrixx/documents/slides.ppt/jcr:content/renditions/original: javax.imageio.IIOException: No decoder available to load the image
*ERROR* [JobHandler: /etc/workflow/instances/2012-06-20/model_171459455015372:/content/dam/geometrixx/documents/slides.ppt/jcr:content/renditions/original] com.day.cq.workflow.impl.job.JobHandler Process execution resulted in an error: java.io.IOException: No decoder available to load the image com.day.cq.workflow.WorkflowException: java.io.IOException: No decoder available to load the image
    at com.day.cq.dam.core.process.CreateThumbnailProcess.execute(CreateThumbnailProcess.java:145)
    at com.day.cq.workflow.impl.job.HandlerBase.executeProcess(HandlerBase.java:172)
    at com.day.cq.workflow.impl.job.JobHandler.process(JobHandler.java:122)
    at org.apache.sling.event.jobs.JobUtil$1.run(JobUtil.java:272)
    at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(Unknown Source)
    at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source)
    at java.lang.Thread.run(Unknown Source)
Caused by: java.io.IOException: No decoder available to load the image
    at com.day.cq.dam.core.process.CreateThumbnailProcess.execute(CreateThumbnailProcess.java:126)
    … 6 more


This is a product bug in CQ5.4 and earlier versions, as it does not correctly handle the dc:format metadata property in particular files.  When these documents contain images with dc:format=image/jpeg, CQ assumes that this property applies to the whole document. Therefore the file gets uploaded into /content/dam with a node ‘metadata’ which has property dc:format=image/jpeg.


The issue has been fixed in CQ5.5 as we have re-engineered the component responsible for handling the mime-type detection for files uploaded to DAM.  When you update to CQ5.5 you will have the final solution to this issue.

As a workaround for earlier versions you should follow these steps:
1. create a file reset-mimetype.ecma under etc/workflow/scripts
2. use the script in the attached file: reset-mimetype.ecma
3. save it
4. edit the workflow model (“DAM Update Asset” workflow)
5. add a “Process step” after the “Metadata extraction” step
6. edit the “Process step”
7. select the etc/workflow/scripts/reset-mimetype.ecma script
8. select the “Handler Advance” checkbox
9. save the workflow
Now the file formats should be correctly identified when uploading to DAM.

reference: (35508/CQ5-13504)

VN:F [1.9.22_1171]
Was this helpful? Please rate the content.
Rating: 5.0/10 (3 votes cast)
CQ5.4: Files uploaded to DAM saved with incorrect mime-type, 5.0 out of 10 based on 3 ratings

One Response to CQ5.4: Files uploaded to DAM saved with incorrect mime-type

  1. Dirk says:

    Be sure that you that the “Handler Advance” flag at the process step. otherwise the workflow step will hang.

    See also: http://dev.day.com/content/kb/home/cq5/DAM/CQDAMTroubleshooting/DAMAssetWrongDCFormatDetected.html
    There you can download a package with the reset-mimetype.ecma script