From c722d36b0362a2ce0e4d4416688d23485b549624 Mon Sep 17 00:00:00 2001 From: krwong <69482343+krwong@users.noreply.github.com> Date: Wed, 20 Nov 2024 16:04:50 -0500 Subject: [PATCH] block jp2 processing for image/vnd.microsoft.icon and add test (#1837) --- .../services/camel/images/ImageDerivativeProcessor.java | 3 ++- .../camel/images/ImageDerivativeProcessorTest.java | 7 +++++++ 2 files changed, 9 insertions(+), 1 deletion(-) diff --git a/services-camel-app/src/main/java/edu/unc/lib/boxc/services/camel/images/ImageDerivativeProcessor.java b/services-camel-app/src/main/java/edu/unc/lib/boxc/services/camel/images/ImageDerivativeProcessor.java index 418f91a248..4ac0a39f5a 100644 --- a/services-camel-app/src/main/java/edu/unc/lib/boxc/services/camel/images/ImageDerivativeProcessor.java +++ b/services-camel-app/src/main/java/edu/unc/lib/boxc/services/camel/images/ImageDerivativeProcessor.java @@ -19,7 +19,8 @@ public class ImageDerivativeProcessor implements Processor { private static final Pattern MIMETYPE_PATTERN = Pattern.compile("^(image.*$|application.*?(photoshop|psd)$)"); - private static final Pattern DISALLOWED_PATTERN = Pattern.compile(".*(vnd\\.fpx|x-icon|x-raw-panasonic).*"); + private static final Pattern DISALLOWED_PATTERN = + Pattern.compile(".*(vnd\\.fpx|x-icon|x-raw-panasonic|vnd\\.microsoft\\.icon).*"); /** * Returns true if the subject of the exchange is a binary which diff --git a/services-camel-app/src/test/java/edu/unc/lib/boxc/services/camel/images/ImageDerivativeProcessorTest.java b/services-camel-app/src/test/java/edu/unc/lib/boxc/services/camel/images/ImageDerivativeProcessorTest.java index 5da7eba5dd..72e5138a57 100644 --- a/services-camel-app/src/test/java/edu/unc/lib/boxc/services/camel/images/ImageDerivativeProcessorTest.java +++ b/services-camel-app/src/test/java/edu/unc/lib/boxc/services/camel/images/ImageDerivativeProcessorTest.java @@ -73,4 +73,11 @@ public void testAllowedImageTypePhotoshop() { assertTrue(ImageDerivativeProcessor.allowedImageType(exchange)); } + + @Test + public void testAllowedImageTypeMicrosoft() { + when(messageIn.getHeader(CdrFcrepoHeaders.CdrBinaryMimeType)).thenReturn("image/vnd.microsoft.icon"); + + assertFalse(ImageDerivativeProcessor.allowedImageType(exchange)); + } }