Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

BMP files are not detected #35

Open
madness-inc opened this issue May 9, 2017 · 3 comments
Open

BMP files are not detected #35

madness-inc opened this issue May 9, 2017 · 3 comments

Comments

@madness-inc
Copy link

madness-inc commented May 9, 2017

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

@jpazardzievska
Copy link

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.

@tbuka
Copy link

tbuka commented Sep 20, 2022

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

@gtsluk
Copy link

gtsluk commented Jun 10, 2023

The parser initializes with enclosed magic.xml only. How can I update it?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants