BMP files are not detected
Add the follwing test to MagicTest and it will fail:
public void testBMP() {
System.out.print("\ntesting BMP image...");
try {
MagicMatch match = Magic.getMagicMatch(new File("test_docs/test.bmp"), true, false);
if (match != null) {
assertEquals("image/bmp", match.getMimeType());
} else {
System.out.print("failed");
fail("no match in testBMP()");
}
System.out.print("ok");
} catch (Exception e) {
e.printStackTrace();
fail("exception in testBMP(). message: " + e);
} catch (Error e) {
e.printStackTrace();
fail("error in testBMP(). message: " + e.getMessage());
}
}
I noticed there's no <match> for image/bmp in magix.xml
This was an issue in the previous version also. My implementation is based on version 0.1.4. In this version (0.1.4) I receive no mime type for bmp file type (null), whereas now in 0.1.5 the implementation is changed I get text/plain for bmp image which is wrong again.
Missing this in magic.xml:
<match> <mimetype>image/bmp</mimetype> <extension>bmp</extension> <description>BMP image data</description> <test offset="0" type="beshort" comparator="=">0x424d</test> <match-list> <match> <mimetype>image/bmp</mimetype> <extension>bmp</extension> <description>JFIF standard</description> <test offset="6" type="string" comparator="=">JFIF</test> </match> </match-list> </match>
Put it under jpeg and it will handle bmp
The parser initializes with enclosed magic.xml only. How can I update it?