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

Tristan Lins commented on TIKA-1141:
------------------------------------

I've now run into this problem as well and am relatively shocked that there 
isn't a viable solution here yet.
The new Magic definitions also only work with non-minified jQuery files.
One of our customers now loaded a {{jquery-1.9.1.min.js}} into our system, 
which was not recognized as JavaScript.
I had to add following magic sequences in {{custom-mimetypes.xml}}:

{code:xml}
            <!-- jQuery -->
            <match value="define(&quot;jquery&quot;," type="string" 
offset="128:8192"/>
            <match value=".write(&quot;&lt;!doctype 
html&gt;&lt;html&gt;&lt;body&gt;&quot;)" type="string" offset="128:8192"/>
{code}

> 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
>         Attachments: jquery-2.0.3.js
>
>
> 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="&lt;html" type="string" offset="0:8192"/> in the 
> tika-mimetypes.xml file.



--
This message was sent by Atlassian Jira
(v8.20.10#820010)

Reply via email to