[ https://issues.apache.org/jira/browse/TIKA-2961?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17109825#comment-17109825 ]
Nick Burch commented on TIKA-2961: ---------------------------------- Based on [https://developer.apple.com/library/archive/documentation/MusicAudio/Reference/CAFSpec/CAF_spec/CAF_spec.html#//apple_ref/doc/uid/TP40001862-CH210-SW3] it looks like the file starts with 4 bytes {{caff}} then a 16 bit version integer then a 16 bit flags integer. Currently, only v1 LE is a defined version Based on that, in {{0bf11aec8}} I've changed the mime magic to look for {{caff}} then v0, v1 or v2 in LE or BE forms. That ought to catch any current of likely-future CAF file, but hopefully avoid false positives from text files > 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)