MNT-16381 Transformers must validate the content stream mimetype

- Addition of AbstractContentTransformer2.strictMimeTypeCheck(...) to check that the
     declared mimetype is the same as the Tika derived mimetype. Controlled by a new alfresco
     global property content.transformer.strict.mimetype.check (set to true by default).
   - Added the UnsupportedTransformationException to a number of transformation callers as
     they should have been handling it already.
   - Modified DifferrentMimeTypeTest to test the new strictMimeTypeCheck.

git-svn-id: https://svn.alfresco.com/repos/alfresco-enterprise/alfresco/BRANCHES/DEV/5.2.N/root@128168 c4b6b30b-aa2e-2d43-bbcb-ca4b014f7261
This commit is contained in:
Alan Davis
2016-06-15 16:11:15 +00:00
parent c4c30abae0
commit 60a8b718bc
8 changed files with 177 additions and 69 deletions

View File

@@ -39,6 +39,7 @@ import org.alfresco.repo.action.ParameterDefinitionImpl;
import org.alfresco.repo.content.transform.ContentTransformer;
import org.alfresco.repo.content.transform.TransformerConfig;
import org.alfresco.repo.content.transform.TransformerDebug;
import org.alfresco.repo.content.transform.UnsupportedTransformationException;
import org.alfresco.repo.security.authentication.AuthenticationUtil;
import org.alfresco.service.cmr.action.ActionServiceException;
import org.alfresco.service.cmr.action.ActionTrackingService;
@@ -446,7 +447,7 @@ public abstract class AbstractTransformationRenderingEngine extends AbstractRend
contentService.transform(contentReader, tempContentWriter, options);
return tempContentWriter;
}
catch (NoTransformerException ntx)
catch (NoTransformerException|UnsupportedTransformationException ntx)
{
{
logger.debug("No transformer found to execute rule: \n" + " reader: " + contentReader + "\n"