Decode escaped commas in various ical property values
This commit is contained in:
parent
9f7cd83f92
commit
c47d2da4e7
3 changed files with 39 additions and 7 deletions
|
@ -443,14 +443,8 @@ class libvcalendar implements Iterator
|
|||
|
||||
case 'LOCATION':
|
||||
case 'DESCRIPTION':
|
||||
if ($this->is_apple()) {
|
||||
$event[strtolower($prop->name)] = str_replace('\,', ',', $prop->value);
|
||||
break;
|
||||
}
|
||||
// else: fall through
|
||||
|
||||
case 'URL':
|
||||
$event[strtolower($prop->name)] = $prop->value;
|
||||
$event[strtolower($prop->name)] = str_replace('\,', ',', $prop->value);
|
||||
break;
|
||||
|
||||
case 'CATEGORY':
|
||||
|
|
|
@ -207,6 +207,19 @@ class libvcalendar_test extends PHPUnit_Framework_TestCase
|
|||
$this->assertEquals('-M', $alarm[1], "Alarm unit");
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
*/
|
||||
function test_escaped_values()
|
||||
{
|
||||
$ical = new libvcalendar();
|
||||
$events = $ical->import_from_file(__DIR__ . '/resources/escaped.ics', 'UTF-8');
|
||||
$event = $events[0];
|
||||
|
||||
$this->assertEquals("House, Street, Zip Place", $event['location'], "Decode escaped commas in location value");
|
||||
$this->assertEquals("Me, meets Them\nThem, meet Me", $event['description'], "Decode description value");
|
||||
}
|
||||
|
||||
/**
|
||||
* @depends test_import
|
||||
*/
|
||||
|
|
25
plugins/libcalendaring/tests/resources/escaped.ics
Normal file
25
plugins/libcalendaring/tests/resources/escaped.ics
Normal file
|
@ -0,0 +1,25 @@
|
|||
BEGIN:VCALENDAR
|
||||
PRODID:-//K Desktop Environment//NONSGML KOrganizer 4.11.3.0//EN
|
||||
VERSION:2.0
|
||||
X-KDE-ICAL-IMPLEMENTATION-VERSION:1.0
|
||||
METHOD:REQUEST
|
||||
BEGIN:VEVENT
|
||||
UID:4113ab9d-ffbb-aa00-c372-deb93de6b539
|
||||
ORGANIZER;CN="Organizor":MAILTO:organizor@example.org
|
||||
DTSTAMP:20140225T160532Z
|
||||
ATTENDEE;CN="Master of Desaster";RSVP=TRUE;PARTSTAT=NEEDS-ACTION;
|
||||
ROLE=REQ-PARTICIPANT;X-UID=100156408:mailto:master@desaster.com
|
||||
ATTENDEE;CN="John Doe";RSVP=TRUE;PARTSTAT=NEEDS-ACTION;
|
||||
ROLE=REQ-PARTICIPANT;X-UID=115484392:mailto:doe@example.com
|
||||
ATTENDEE;CN="Thomas Kolab";RSVP=TRUE;PARTSTAT=NEEDS-ACTION;
|
||||
ROLE=REQ-PARTICIPANT;X-UID=115936264:mailto:thomas@kolab.org
|
||||
CREATED:20140225T160335Z
|
||||
LAST-MODIFIED:20140225T160335Z
|
||||
DESCRIPTION:Me\, meets Them\nThem\, meet Me
|
||||
SUMMARY:Meeting w/Them
|
||||
LOCATION:House\, Street\, Zip Place
|
||||
DTSTART:20140305T150000Z
|
||||
DTEND:20140305T170000Z
|
||||
TRANSP:OPAQUE
|
||||
END:VEVENT
|
||||
END:VCALENDAR
|
Loading…
Add table
Reference in a new issue