[
https://issues.apache.org/jira/browse/TIKA-3710?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17539580#comment-17539580
]
Tim Allison commented on TIKA-3710:
-----------------------------------
This works on the test file:
{noformat}
<magic priority="60">
<match value="<HTML" type="string" offset="0"/>
<match value="<html" type="string" offset="0"/>
<match value="<HEAD" type="string" offset="0"/>
<match value="<head" type="string" offset="0"/>
<match value="<BODY" type="string" offset="0"/>
<match value="<body" type="string" offset="0"/>
<match value="<TITLE" type="string" offset="0"/>
<match value="<title" type="string" offset="0"/>
<match value="<DIV" type="string" offset="0"/>
<match value="<div" type="string" offset="0"/>
<match value="<h1" type="string" offset="0"/>
<match value="<H1" type="string" offset="0"/>
<match value="<h2" type="string" offset="0"/>
<match value="<H2" type="string" offset="0"/>
<match value="<h3" type="string" offset="0"/>
<match value="<H3" type="string" offset="0"/>
</magic>
<!-- The magic priority needs to be lower than that of -->
<!-- files which contain HTML within them, eg mime emails -->
<magic priority="40">
<match value="<!DOCTYPE HTML" type="string" offset="0:64"/>
<match value="<!DOCTYPE html" type="string" offset="0:64"/>
<match value="<!doctype HTML" type="string" offset="0:64"/>
<match value="<!doctype html" type="string" offset="0:64"/>
<match value="<HEAD" type="string" offset="0:64"/>
<match value="<head" type="string" offset="0:64"/>
<match value="<TITLE" type="string" offset="0:64"/>
<match value="<title" type="string" offset="0:64"/>
<match value="<HTML" type="string" offset="0:64"/>
<match value="<html" type="string" offset="0:128"/>
</magic>
{noformat}
> HTML document detected incorrect as message/rfc822
> --------------------------------------------------
>
> Key: TIKA-3710
> URL: https://issues.apache.org/jira/browse/TIKA-3710
> Project: Tika
> Issue Type: Bug
> Components: detector
> Affects Versions: 2.3.0
> Reporter: Sam Stephens
> Priority: Major
> Attachments: html-that-looks-like-rfc822.html
>
>
> I'm detecting content types and extracting text from documents using the
> AutoDetectParser.
> I've received some documents that are HTML fragments generated from emails.
> The documents are clearly HTML, not emails, but the AutoDetectParser gives me
> the MIME type message/rfc822 and no text. I've attached an example.
> It looks like the presence of From:, Sent:, and Subject: at the beginning of
> lines is why the documents are matching RFC822. However, I believe the
> presence of HTML before these headers means the document is not valid RFC822.
--
This message was sent by Atlassian Jira
(v8.20.7#820007)