[ https://issues.apache.org/jira/browse/TIKA-1141?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16299893#comment-16299893 ]
Daniel Goltz commented on TIKA-1141: ------------------------------------ [~gagravarr] this is our soltution to this issue: {code:java} private String detectContentType(FilePath file) throws InterruptedException, IOException { Tika tika = new Tika(); try (InputStream stream = file.read()) { if (file.getName().endsWith(".js")) { // Tika has a shortcoming not able to properly identify JavaScript files, determine type by extension // rather than Tika for those. return "application/javascript"; } else { return tika.detect(stream, file.getName()); } } } {code} As you can see, the file name exists and is definitly pased to Tika otherwise our solution wouldn't have worked. We are using a jquery version that was minified in-house but this should have worked in any case if the file name is passed. > javascript files that contain "<html" are detected as text/html > --------------------------------------------------------------- > > Key: TIKA-1141 > URL: https://issues.apache.org/jira/browse/TIKA-1141 > Project: Tika > Issue Type: Bug > Components: mime > Affects Versions: 1.2 > Reporter: David Hara > Priority: Minor > > The Mimetypes detector will return text/html as the mimetype for any > javascript file that contains the string "<html" in it. I believe this is due > to the rule <match value="<html" type="string" offset="0:8192"/> in the > tika-mimetypes.xml file. -- This message was sent by Atlassian JIRA (v6.4.14#64029)