[
https://issues.apache.org/jira/browse/TIKA-4172?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17789621#comment-17789621
]
martin k. commented on TIKA-4172:
---------------------------------
Right, [~tilman], however, {{application/octet-stream}} is also a valid MIME
type.
But don't you agree that when a file is classified by content as
{{application/octet-stream}} and I provide the information that the file just
so happens to be called {{something.sql}} and has a content-type of
{{application/applefile}}, then tika certainly shouldn't claim it to be
{{text/x-sql}}, which it is least of all of them?
Maybe one issue is that the file itself does seem to be corrupt. Libmagic 5.45
reports it as "MacBinary III INVALID date", but tika doesn't seem to want to
treat it as {{application/applefile}} at all:
{{% curl -T ~/.tmp/d0101c66_mySQL40.sql -H "Content-Type:
application/applefile" -H "Content-Disposition: attachment;
filename=d0101c66_mySQL40.sql" http://localhost:9998/meta/Content-Type}}
{{Failed to get metadata field Content-Type}}
Regardless though, it doesn't seem right to then ignore the fact that the file
*is* binary, and return a {text/*}} content-type instead. Do you agree?
> Apple binary file incorrectly identified as text/x-sql due to filename
> ----------------------------------------------------------------------
>
> Key: TIKA-4172
> URL: https://issues.apache.org/jira/browse/TIKA-4172
> Project: Tika
> Issue Type: Bug
> Components: general
> Affects Versions: 2.9.1
> Reporter: martin k.
> Priority: Minor
>
> This is related to [https://github.com/eikek/docspell/issues/2376] and
> [https://github.com/eikek/docspell/issues/2403.]
> Take the following Base64 encoding of a binary Apple-generated file. No idea
> what it does. You can get the file by piping the following to e.g. {{base64
> -d > something.sql}}
> {code:java}
> ABRkMDEwMWM2Nl9teVNRTDQwLnNxbAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA
> AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAbUJJTgAA
> AAAAAAAAAAAAAAAAAACCgf+/AAA=
> {code}
> If this file is name {{{}something.sql{}}}, then Tika will classify it as
> {{{}text/x-sql{}}}, which it is not. It seems like more weight is given to
> the filename (extension) than the fact that the file is binary anyway.
--
This message was sent by Atlassian Jira
(v8.20.10#820010)