You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@tika.apache.org by ta...@apache.org on 2016/06/15 11:13:24 UTC

tika git commit: TIKA-2006 -- add mime definitions for iCal and vCalendar

Repository: tika
Updated Branches:
  refs/heads/master 06633cc18 -> 4d308fd70


TIKA-2006 -- add mime definitions for iCal and vCalendar


Project: http://git-wip-us.apache.org/repos/asf/tika/repo
Commit: http://git-wip-us.apache.org/repos/asf/tika/commit/4d308fd7
Tree: http://git-wip-us.apache.org/repos/asf/tika/tree/4d308fd7
Diff: http://git-wip-us.apache.org/repos/asf/tika/diff/4d308fd7

Branch: refs/heads/master
Commit: 4d308fd7015391c9cdfd13ba6990dcd6e8496138
Parents: 06633cc
Author: tballison <ta...@mitre.org>
Authored: Wed Jun 15 07:13:15 2016 -0400
Committer: tballison <ta...@mitre.org>
Committed: Wed Jun 15 07:13:15 2016 -0400

----------------------------------------------------------------------
 CHANGES.txt                                          |  2 ++
 .../org/apache/tika/mime/tika-mimetypes.xml          | 11 +++++++++++
 .../java/org/apache/tika/mime/TestMimeTypes.java     |  6 ++++++
 .../test/resources/test-documents/testICalendar.ics  | 15 +++++++++++++++
 .../test/resources/test-documents/testVCalendar.vcs  | 10 ++++++++++
 5 files changed, 44 insertions(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/tika/blob/4d308fd7/CHANGES.txt
----------------------------------------------------------------------
diff --git a/CHANGES.txt b/CHANGES.txt
index 6008b51..59d2451 100644
--- a/CHANGES.txt
+++ b/CHANGES.txt
@@ -1,5 +1,7 @@
 Release 1.14 - ???
 
+  * Add mime definitions of iCal and vCalendar (TIKA-2006).
+
   * Upgrade to PDFBox 2.0.2 (TIKA-1996).
 
   * Add configurable maximum threshold for number of events extracted

http://git-wip-us.apache.org/repos/asf/tika/blob/4d308fd7/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 8a79844..ca84d94 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
@@ -5494,8 +5494,14 @@
   </mime-type>
 
   <mime-type type="text/calendar">
+    <magic priority="50">
+      <match value="BEGIN:VCALENDAR" type="string" offset="0">
+        <match value="VERSION:2.0" type="string" offset="15:30"/>
+      </match>
+    </magic>
     <glob pattern="*.ics"/>
     <glob pattern="*.ifb"/>
+    <sub-class-of type="text/plain"/>
   </mime-type>
 
   <mime-type type="text/css">
@@ -6250,6 +6256,11 @@
   </mime-type>
 
   <mime-type type="text/x-vcalendar">
+    <magic priority="50">
+      <match value="BEGIN:VCALENDAR" type="string" offset="0">
+        <match value="VERSION:1.0" type="string" offset="15:30"/>
+      </match>
+    </magic>
     <glob pattern="*.vcs"/>
     <sub-class-of type="text/plain"/>
   </mime-type>

http://git-wip-us.apache.org/repos/asf/tika/blob/4d308fd7/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 46d3f5d..3f22842 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
@@ -1031,6 +1031,12 @@ public class TestMimeTypes {
         assertTypeByData("application/pkcs7-signature", "testPKCS17Sig-v3.xml.p7m");
         assertTypeByData("application/pkcs7-signature", "testPKCS17Sig-v4.xml.p7m");
     }
+
+    @Test
+    public void testVandICalendars() throws Exception {
+        assertType("text/calendar", "testICalendar.ics");
+        assertType("text/x-vcalendar", "testVCalendar.vcs");
+    }
     
     private void assertText(byte[] prefix) throws IOException {
         assertMagic("text/plain", prefix);

http://git-wip-us.apache.org/repos/asf/tika/blob/4d308fd7/tika-parsers/src/test/resources/test-documents/testICalendar.ics
----------------------------------------------------------------------
diff --git a/tika-parsers/src/test/resources/test-documents/testICalendar.ics b/tika-parsers/src/test/resources/test-documents/testICalendar.ics
new file mode 100644
index 0000000..cbd9bee
--- /dev/null
+++ b/tika-parsers/src/test/resources/test-documents/testICalendar.ics
@@ -0,0 +1,15 @@
+BEGIN:VCALENDAR
+VERSION:2.0
+METHOD:PUBLISH
+BEGIN:VEVENT
+DTSTART:20010701T213000Z
+DTEND:20010701T223000Z
+LOCATION:Banque Nationale Stage ()
+UID:20141020T130403Z@montrealjazzfest.com
+DTSTAMP:20141020T130403Z
+SUMMARY:Susi Hyldgaard - Festival International de Jazz de Montr�al
+DESCRIPTION:SUSI HYLDGAARD\n\nAs the new millennium opens, the prevailing style is the m�lange... but you still have to know how to measure out the ingredients. Susi Hyldgaard\u2019s facility with jazz and world music is stunning the critics. Want proof? She\u2019s been compared to Bj�rk, Neneh Cherry and Cassandra Wilson but the singer/pianist/accordionist sets herself apart by virtue of a thoroughly personal style, spontaneous and blazingly passionate. Without a doubt, one of the most striking talents to emerge from the Danish music scene in the last five years. \n\nhttp://www.montrealjazzfest.com/program/concert.aspx?id=3579\n
+PRIORITY:5
+CLASS:PUBLIC
+END:VEVENT
+END:VCALENDAR
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/tika/blob/4d308fd7/tika-parsers/src/test/resources/test-documents/testVCalendar.vcs
----------------------------------------------------------------------
diff --git a/tika-parsers/src/test/resources/test-documents/testVCalendar.vcs b/tika-parsers/src/test/resources/test-documents/testVCalendar.vcs
new file mode 100644
index 0000000..b6ea937
--- /dev/null
+++ b/tika-parsers/src/test/resources/test-documents/testVCalendar.vcs
@@ -0,0 +1,10 @@
+BEGIN:VCALENDAR
+VERSION:1.0
+BEGIN:VEVENT
+DTSTART:20121201T210000
+DTEND:20121201T220000
+LOCATION;ENCODING=QUOTED-PRINTABLE:Mississippi Studios (3939 N Mississippi Ave., Portland, OR)
+DESCRIPTION;ENCODING=QUOTED-PRINTABLE:
+SUMMARY;ENCODING=QUOTED-PRINTABLE:Battleme, My Goodness, the Ax
+PRIORITY:3END:VEVENT
+END:VCALENDAR
\ No newline at end of file