simplemagic icon indicating copy to clipboard operation
simplemagic copied to clipboard

Magic number and bug fixed

Open J-Christophe opened this issue 8 years ago • 1 comments

  • Bug fixed : I found a small problem in your code. It seems that no exception was send when a file was given as parameter of util.findMatch(...). Here is the problem in your code <pre> if (file.length() < readSize) { readSize = (int) file.length(); } if (readSize == 0) { return ContentInfo.EMPTY_INFO; } </pre> file.length does not send an Exception if the file does not exist but 0L. Then, when the file does not exist, ContentInfo.EMPTY_INFO is returned. I added a condition to check the file is well readable (if it is readable then it exists).

  • Feature I added the following method public ContentInfo findMatch(final URL url) throws IOException

  • Magic number I added the magic number for VOTABLE (http://www.ivoa.net/documents/VOTable/), XSD (I did not find a mime type), OGG (I do not know how to make the difference between sound and video)

  • MimeType I added the mime type for netcdf (I was not written with the magic number expression)

J-Christophe avatar Aug 11 '17 01:08 J-Christophe

Sorry for the delay on this. If you can break these into individual PRs then I'll take them but I don't like to mix issues. I'm also happy to split them up myself. Thanks.

j256 avatar Jul 12 '18 14:07 j256