jmimemagic
jmimemagic copied to clipboard
svg mime type not found
<dependency>
<groupId>jmimemagic</groupId>
<artifactId>jmimemagic</artifactId>
<version>0.1.2</version>
</dependency>
public String getMimeType(byte[] file) throws Exception {
MagicMatch match = Magic.getMagicMatch(file);
return match.getMimeType();
}
public void testContentTypeFind() throws Exception {
TestCase.assertEquals(
"image/svg+xml",
getMimeType(filenameToByteArray("public/assets/svg/avatar-1.svg"))
);
}
Expected :image/svg+xml Actual :text/plain