Merged DEV to HEAD (4.2.0)

ALF-2875 : Rendition Service transforms incorrect mimetypes
      - Added a check of target mimeType


git-svn-id: https://svn.alfresco.com/repos/alfresco-enterprise/alfresco/HEAD/root@54634 c4b6b30b-aa2e-2d43-bbcb-ca4b014f7261
This commit is contained in:
Pavel Yurke
2013-08-29 11:33:04 +00:00
parent 43902752e8
commit 38d6f1e485

View File

@@ -240,6 +240,30 @@ public class ImageRenderingEngine extends AbstractTransformationRenderingEngine
throw new IllegalArgumentException(msg.toString()); throw new IllegalArgumentException(msg.toString());
} }
} }
/**
* Check mimeType of target.
* @param context
*/
private void checkTargetMimeType(RenderingContext context)
{
String targetMimeType = getTargetMimeType(context);
// Target mime type should only be an image MIME type
if (targetMimeType == null || !targetMimeType.startsWith("image"))
{
StringBuilder msg = new StringBuilder();
msg.append("Target has illegal non-image MIME type: ").append(targetMimeType).append(". ")
.append("Use image as a source or configure target parameter \"").append(PARAM_MIME_TYPE).append("\"");
throw new IllegalArgumentException(msg.toString());
}
}
@Override
protected void render(RenderingContext context)
{
checkTargetMimeType(context);
super.render(context);
}
/* /*