[ 
https://issues.apache.org/jira/browse/TIKA-2567?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16355402#comment-16355402
 ] 

Nick Burch commented on TIKA-2567:
----------------------------------

The fun and joy of many programming languages looking very similar, whilst 
having no unique file magic... I've tried to tighten up the matlib function 
detection in dbf35b6, your JS file is now correctly detect as JS when a 
filename is also passed

> Tika mistakenly determines mimetype of .min.js file as matlab
> -------------------------------------------------------------
>
>                 Key: TIKA-2567
>                 URL: https://issues.apache.org/jira/browse/TIKA-2567
>             Project: Tika
>          Issue Type: Bug
>          Components: detector
>    Affects Versions: 1.17
>            Reporter: Anto
>            Priority: Major
>         Attachments: bannerboy.min.js
>
>
> Attached file is misinterpreted as being a matlab file when it's really just 
> a minimised javascript file.
> Using:
> {code:java}
> private final DefaultDetector mimeTypeDetector = new DefaultDetector();
> public String determineMimeType(final byte[] data, final String fileName) {
>     final TikaInputStream inputStream = TikaInputStream.get(data);
>     final Metadata metadata = new Metadata();
>     metadata.set(Metadata.RESOURCE_NAME_KEY, fileName);
>     try {
>         return mimeTypeDetector.detect(inputStream, metadata).toString();
>     } catch (final IOException e) {
>         throw new ApiException(e);
>     }
> }{code}



--
This message was sent by Atlassian JIRA
(v7.6.3#76005)

Reply via email to