TIKA-2011 -- add mime detection for Endnote Import file
Project: http://git-wip-us.apache.org/repos/asf/tika/repo Commit: http://git-wip-us.apache.org/repos/asf/tika/commit/ade60ed6 Tree: http://git-wip-us.apache.org/repos/asf/tika/tree/ade60ed6 Diff: http://git-wip-us.apache.org/repos/asf/tika/diff/ade60ed6 Branch: refs/heads/TIKA-1508 Commit: ade60ed6277f6b489995c70f521dd9c17f6f608b Parents: 6291648 Author: tballison <[email protected]> Authored: Wed Jun 15 10:40:58 2016 -0400 Committer: tballison <[email protected]> Committed: Wed Jun 15 10:40:58 2016 -0400 ---------------------------------------------------------------------- CHANGES.txt | 13 ++++++------- .../resources/org/apache/tika/mime/tika-mimetypes.xml | 12 ++++++++++++ .../test/java/org/apache/tika/mime/TestMimeTypes.java | 6 ++++++ .../resources/test-documents/testEndNoteImportFile.enw | 10 ++++++++++ 4 files changed, 34 insertions(+), 7 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/tika/blob/ade60ed6/CHANGES.txt ---------------------------------------------------------------------- diff --git a/CHANGES.txt b/CHANGES.txt index 82400d5..2da92b8 100644 --- a/CHANGES.txt +++ b/CHANGES.txt @@ -1,12 +1,11 @@ Release 1.14 - ??? - * Add mime magic for DJVU files (TIKA-2009). - - * Add mime definition and parser for MS Owner File (TIKA-2008). - - * Add mime definition for Windows Media Metafile (TIKA-2004). - - * Add mime definitions of iCal and vCalendar (TIKA-2006). + * Add mime types, mime magic and/or globs for: + * Endnote Import File (TIKA-2011) + * DJVU files (TIKA-2009) + * MS Owner File (TIKA-2008) + * Windows Media Metafile (TIKA-2004) + * iCal and vCalendar (TIKA-2006) * Upgrade to PDFBox 2.0.2 (TIKA-1996). http://git-wip-us.apache.org/repos/asf/tika/blob/ade60ed6/tika-core/src/main/resources/org/apache/tika/mime/tika-mimetypes.xml ---------------------------------------------------------------------- diff --git a/tika-core/src/main/resources/org/apache/tika/mime/tika-mimetypes.xml b/tika-core/src/main/resources/org/apache/tika/mime/tika-mimetypes.xml index e8d2b6f..a94f188 100644 --- a/tika-core/src/main/resources/org/apache/tika/mime/tika-mimetypes.xml +++ b/tika-core/src/main/resources/org/apache/tika/mime/tika-mimetypes.xml @@ -3113,6 +3113,18 @@ <sub-class-of type="text/x-tika-text-based-message"/> </mime-type> + <mime-type type="application/x-endnote-refer"> + <magic priority="80"> + <match value="%A " type="string" offset="0:50"> + <match value="\n%D " type="string" offset="0:1000"> + <match value="\n%T " type="string" offset="0:1000"/> + </match> + </match> + </magic> + <glob pattern="*.enw"/> + <glob pattern="*.enr"/> + </mime-type> + <mime-type type="application/x-killustrator"> <_comment>KIllustrator File</_comment> <glob pattern="*.kil"/> http://git-wip-us.apache.org/repos/asf/tika/blob/ade60ed6/tika-parsers/src/test/java/org/apache/tika/mime/TestMimeTypes.java ---------------------------------------------------------------------- diff --git a/tika-parsers/src/test/java/org/apache/tika/mime/TestMimeTypes.java b/tika-parsers/src/test/java/org/apache/tika/mime/TestMimeTypes.java index c0a6cea..102b005 100644 --- a/tika-parsers/src/test/java/org/apache/tika/mime/TestMimeTypes.java +++ b/tika-parsers/src/test/java/org/apache/tika/mime/TestMimeTypes.java @@ -1057,6 +1057,12 @@ public class TestMimeTypes { assertTypeByData("image/vnd.djvu", "testDJVU.djvu"); } + @Test + public void testEndNoteImport() throws Exception { + assertType("application/x-endnote-refer", "testEndNoteImportFile.enw"); + assertTypeByData("application/x-endnote-refer", "testEndNoteImportFile.enw"); + } + private void assertText(byte[] prefix) throws IOException { assertMagic("text/plain", prefix); } http://git-wip-us.apache.org/repos/asf/tika/blob/ade60ed6/tika-parsers/src/test/resources/test-documents/testEndNoteImportFile.enw ---------------------------------------------------------------------- diff --git a/tika-parsers/src/test/resources/test-documents/testEndNoteImportFile.enw b/tika-parsers/src/test/resources/test-documents/testEndNoteImportFile.enw new file mode 100644 index 0000000..7a68fcf --- /dev/null +++ b/tika-parsers/src/test/resources/test-documents/testEndNoteImportFile.enw @@ -0,0 +1,10 @@ +%A Fasouliotis, S J +%A Schenker, J G +%D 1997 +%J Eur J Obstet Gynecol Reprod Biol +%N 2 +%P 183-90 +%T Multifetal pregnancy reduction: a review of the world results for the period 1993-1996. +%U +%V 75 +%@ 0301-2115 \ No newline at end of file
