[MGNLIMG-177] CachingImageStreamer might store incorrect jcr:mimeType Created: 23/Nov/15  Updated: 15/Feb/16  Resolved: 08/Feb/16

Status: Closed
Project: Imaging
Component/s: None
Affects Version/s: 3.2.4
Fix Version/s: 3.2.5

Type: Bug Priority: Neutral
Reporter: Richard Unger Assignee: Bradley Andersen
Resolution: Fixed Votes: 0
Labels: support
Remaining Estimate: 0d
Time Spent: 3h
Original Estimate: Not Specified

Issue Links:
Relates
relates to MGNLIMG-171 Set contentType correctly in ImagingS... Closed
dependency
is depended upon by MGNLSTK-1515 Make the list of STKAssetRenderer's a... Closed
relation
is related to MGNLIMG-168 Variation with png images leads to bl... Closed
Template:
Acceptance criteria:
Empty
Task DoD:
[ ]* Doc/release notes changes? Comment present?
[ ]* Downstream builds green?
[ ]* Solution information and context easily available?
[ ]* Tests
[ ]* FixVersion filled and not yet released
[ ]  Architecture Decision Record (ADR)
Bug DoR:
[ ]* Steps to reproduce, expected, and actual results filled
[ ]* Affected version filled
Date of First Response:
Sprint: Basel 30
Story Points: 5

 Description   

DefaultImageGenerator and ImagingServlet (line ~98) used to hard-code the mime-type based on the imaging variation "outputFormat", which in many situations equals the filename extension:

// we need to set mimetype here explicitly because extension (and type) is determined at runtime depending on what the image op chain does
response.setContentType("image/" + outputFormat);

This was not correct, in particular for the extension "jpg" (a valid file extension for JPEGs) the resulting mime-type image/jpg is not the correct mime-type for JPEGs* (which needs to be image/jpeg).
While most browsers seem to cope with image/jpg, some (eg IE11) do not. The result is that image variations of jpg images are not displayed for us in IE11.

Fix of MGNLIMG-171

This problem was targeted with issue MGNLIMG-171 and now the ImagingServlet will correctly return the mime-type image/jpeg for extension "jpg" according to the given output format.

Remaining todo

However, CachingImageStreamer still persists cached images with the wrong property jcr:mimeType.

This is not causing the output to be returned with the wrong mime-type as the servlet will still correctly determine the content-type from the output format, but this should be fixed nevertheless.

See CachingImageStreamer line 220:

imageData.setAttribute(FileProperties.PROPERTY_CONTENTTYPE, "image/" + generator.getOutputFormat(parameterProvider).getFormatName());

Generated at Mon Feb 12 02:13:02 CET 2024 using Jira 9.4.2#940002-sha1:46d1a51de284217efdcb32434eab47a99af2938b.