Repository: tika
Updated Branches:
  refs/heads/2.x b480d43f5 -> f90193aa0


TIKA-2006 -- add mime definitions for ical and vcal


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

Branch: refs/heads/2.x
Commit: f90193aa0a41550a7ba009046b4bdb6e647a2aed
Parents: b480d43
Author: tballison <[email protected]>
Authored: Wed Jun 15 07:17:41 2016 -0400
Committer: tballison <[email protected]>
Committed: Wed Jun 15 07:17:41 2016 -0400

----------------------------------------------------------------------
 CHANGES.txt                                          |  2 ++
 .../java/org/apache/tika/mime/TestMimeTypes.java     |  6 ++++++
 .../org/apache/tika/mime/tika-mimetypes.xml          | 11 +++++++++++
 .../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/f90193aa/CHANGES.txt
----------------------------------------------------------------------
diff --git a/CHANGES.txt b/CHANGES.txt
index 7a1cd65..9a4acc2 100644
--- a/CHANGES.txt
+++ b/CHANGES.txt
@@ -10,6 +10,8 @@ Release 2.0 - Future Development
 
 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/f90193aa/tika-app/src/test/java/org/apache/tika/mime/TestMimeTypes.java
----------------------------------------------------------------------
diff --git a/tika-app/src/test/java/org/apache/tika/mime/TestMimeTypes.java 
b/tika-app/src/test/java/org/apache/tika/mime/TestMimeTypes.java
index b852de0..56cc725 100644
--- a/tika-app/src/test/java/org/apache/tika/mime/TestMimeTypes.java
+++ b/tika-app/src/test/java/org/apache/tika/mime/TestMimeTypes.java
@@ -969,6 +969,12 @@ public class TestMimeTypes extends TikaTest {
         assertType("text/vtt", "testWebVTT.vtt");
         assertTypeByData("text/vtt", "testWebVTT.vtt");
     }
+
+    @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/f90193aa/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 f61d15e..736078a 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
@@ -5329,8 +5329,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">
@@ -6080,6 +6086,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/f90193aa/tika-test-resources/src/test/resources/test-documents/testICalendar.ics
----------------------------------------------------------------------
diff --git 
a/tika-test-resources/src/test/resources/test-documents/testICalendar.ics 
b/tika-test-resources/src/test/resources/test-documents/testICalendar.ics
new file mode 100644
index 0000000..cbd9bee
--- /dev/null
+++ b/tika-test-resources/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:[email protected]
+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’s facility with jazz and world music is stunning 
the critics. Want proof? She’s 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/f90193aa/tika-test-resources/src/test/resources/test-documents/testVCalendar.vcs
----------------------------------------------------------------------
diff --git 
a/tika-test-resources/src/test/resources/test-documents/testVCalendar.vcs 
b/tika-test-resources/src/test/resources/test-documents/testVCalendar.vcs
new file mode 100644
index 0000000..b6ea937
--- /dev/null
+++ b/tika-test-resources/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

Reply via email to