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

spadezhang commented on TIKA-2961:
----------------------------------

audio/x-caf type detection only matches the string{code:xml}
  <mime-type type="audio/x-caf">
     <_comment>Core Audio Format</_comment>
     <_comment>com.apple.coreaudio-format</_comment>
     <magic priority="60">
        <match value="caff" type="string" offset="0" />
     </magic>
     <glob pattern="*.caf"/>
  </mime-type>
{code}
I used xxd to read several cafe files, and their file headers are consistent
test file from:https://filesamples.com/formats/caf
{code}
λ xxd -l 100 sample1.caf
00000000: 6361 6666 0001 0000 6465 7363 0000 0000  caff....desc....
00000010: 0000 0020 40e5 8880 0000 0000 6c70 636d  ... @.......lpcm
00000020: 0000 0000 0000 0004 0000 0001 0000 0002  ................
00000030: 0000 0010 6672 6565 0000 0000 0000 0fb0  ....free........
00000040: 0000 0000 0000 0000 0000 0000 0000 0000  ................
00000050: 0000 0000 0000 0000 0000 0000 0000 0000  ................
00000060: 0000 0000                                ....
{code}
i think we need to change modify tika-mimetypes.xml

> Tika 在识别以caff开始的txt文档时会把它错误地识别为audio/x-caf 音频类型
> -----------------------------------------------
>
>                 Key: TIKA-2961
>                 URL: https://issues.apache.org/jira/browse/TIKA-2961
>             Project: Tika
>          Issue Type: Bug
>          Components: core
>    Affects Versions: 1.20
>            Reporter: Feng Jiao Jiang
>            Priority: Critical
>              Labels: newbie
>         Attachments: 1.txt
>
>
> public String getFileType(File file) {
>  String fileType = "";
>  try {
>  Tika tika = new Tika();
>  fileType = tika.detect(file);
>  } catch (Exception e) {
>  e.printStackTrace();
>  }
>  return fileType;
> }
> 以上代码在识别以caff开头的txt文档时,会错误地识别为 audio/x-caf 音频类型



--
This message was sent by Atlassian Jira
(v8.3.4#803005)

Reply via email to