Skip to content

Commit

Permalink
TIKA-4244 -- improve ics detection (#1731)
Browse files Browse the repository at this point in the history
(cherry picked from commit f78dc99)
  • Loading branch information
tballison committed Apr 25, 2024
1 parent 0976b1f commit b419cf5
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -7213,7 +7213,7 @@
<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 value="\nVERSION:2.0" type="string" offset="15:360"/>
</match>
</magic>
<glob pattern="*.ics"/>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1235,6 +1235,10 @@ public void testVandICalendars() throws Exception {
assertType("text/x-vcalendar", "testVCalendar.vcs");
assertTypeByData("text/calendar", "testICalendar.ics");
assertTypeByData("text/x-vcalendar", "testVCalendar.vcs");
//TIKA-4244
//this tests detection with content intervening between the BEGIN:VCALENDAR and the VERSION:2.0 entry
assertType("text/calendar", "testICalendar_w_prodId.ics");
assertTypeByData("text/calendar", "testICalendar_w_prodId.ics");
}

@Test
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
BEGIN:VCALENDAR
PRODID:-//Example Corp//iCalendar Export//EN
VERSION:2.0
BEGIN:VEVENT
UID:[email protected]
DTSTAMP:20240101T080000Z
DTSTART:20240101T100000Z
DTEND:20240101T120000Z
SUMMARY:Sample HTML Event
DESCRIPTION:This is a sample event with an HTML description.
X-ALT-DESC;FMTTYPE=text/html:<html><body><h1>Sample HTML Event</h1><p>This is a sample event with an <strong>HTML</strong> description.</p></body></html>
END:VEVENT
END:VCALENDAR

0 comments on commit b419cf5

Please sign in to comment.