[
https://issues.apache.org/jira/browse/TIKA-1461?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=14188216#comment-14188216
]
Cservenak, Tamas commented on TIKA-1461:
----------------------------------------
Seems this change in {{custom-mimetypes.xml}} solves the problem:
{noformat}
<mime-type type="application/java-archive">
<sub-class-of type="application/zip"/>
<glob pattern="*.jar"/>
<magic priority="55">
<match value="PK\003\004" type="string" offset="0"/>
<match value="PK\005\006" type="string" offset="0"/>
<match value="PK\x07\x08" type="string" offset="0"/>
</magic>
</mime-type>
{noformat}
This change basically adds a magic to {{application/java-archive}} (that
basically has none, it inherits from {{application/zip}}) with priority of 55.
Hence, later hinting done in TIKA-1292 selects {{application/java-archive}}
over {{application/x-msdownload;format=pe}}.
> Bad mime detection of certain JAR file
> --------------------------------------
>
> Key: TIKA-1461
> URL: https://issues.apache.org/jira/browse/TIKA-1461
> Project: Tika
> Issue Type: Bug
> Components: core
> Affects Versions: 1.6
> Reporter: Cservenak, Tamas
>
> Given this "ordinary" Java JAR file
> https://maven.atlassian.com/content/groups/public/com/atlassian/support/healthcheck/support-healthcheck-plugin/1.0.3/support-healthcheck-plugin-1.0.3.jar
> Manually inspected and tested it, it is a Jar file and is valid one.
> Still, Tika Core's Detector detects it as type {{application/x-msdownload;
> format=pe}}. Tthe detection is "hinted" with file name, hence "jar" hint is
> present, still it's not detected as desired {{application/java-archive}}.
> IMO, this happens due to the problem with priority of
> {{application/x-msdownload; format=pe}}, which is 55. If it would be 50, the
> "mediation" would kick in, see TIKA-1292.
> Changing/overriding magic priority is not possible using
> {{custom-mimetypes.xml}} is also not possible.
> Unsure what the correct solution is here, nor how to circumvent this without
> patching Tika.
> The problem affects versions 1.5 but also 1.6, but we target 1.6.
--
This message was sent by Atlassian JIRA
(v6.3.4#6332)