Skip to content

Commit

Permalink
block jp2 processing for image/vnd.microsoft.icon and add test (#1837)
Browse files Browse the repository at this point in the history
  • Loading branch information
krwong authored Nov 20, 2024
1 parent 8392846 commit c722d36
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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));
}
}

0 comments on commit c722d36

Please sign in to comment.