You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@tika.apache.org by "Konstantin (JIRA)" <ji...@apache.org> on 2014/11/20 19:47:34 UTC
[jira] [Issue Comment Deleted] (TIKA-1485) Wrong mimetype detection
[ https://issues.apache.org/jira/browse/TIKA-1485?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
Konstantin updated TIKA-1485:
-----------------------------
Comment: was deleted
(was: {quote}If Tika doesn't know what something is from the mime magic (or from container detectors), but there is a matching hint from the file extension, then the extension will be used to guess the type{quote}
that's wrong logic in my opinion)
> Wrong mimetype detection
> ------------------------
>
> Key: TIKA-1485
> URL: https://issues.apache.org/jira/browse/TIKA-1485
> Project: Tika
> Issue Type: Bug
> Affects Versions: 1.5, 1.6
> Reporter: Konstantin
> Attachments: file.jpg, file_corrupted, file_corrupted.jpg, jpg_file
>
>
> [SCENARIO]
> # get a valid jpg (almost all file types that have a header are affected).
> # insert some whitespaces or line breaks in the beginning of file (it becomes invalid)
> # check file mimetype:
> {code}
> Metadata metadata = new Metadata();
> metadata.set(Metadata.RESOURCE_NAME_KEY, file.toString());
> MediaType mimetype = new TikaConfig().getDetector().detect(TikaInputStream.get(file), metadata);
> {code}
> [RESULT]
> detected mimetype is "image/jpeg"
> [EXPECTED]
> "application/octet-stream"
--
This message was sent by Atlassian JIRA
(v6.3.4#6332)