2 commits - plugins/libcalendaring

Thomas Brüderli bruederli at kolabsys.com
Wed Feb 26 12:15:55 CET 2014


 plugins/libcalendaring/libvcalendar.php            |    8 ------
 plugins/libcalendaring/tests/libvcalendar.php      |   13 ++++++++++
 plugins/libcalendaring/tests/resources/escaped.ics |   25 +++++++++++++++++++++
 3 files changed, 39 insertions(+), 7 deletions(-)

New commits:
commit b828aad2b40d361b886087b7ae0ff503b544ce4f
Merge: c47d2da 0bc70b7
Author: Thomas Bruederli <bruederli at kolabsys.com>
Date:   Wed Feb 26 12:15:32 2014 +0100

    Merge branch 'master' of ssh://git.kolab.org/git/roundcubemail-plugins-kolab



commit c47d2da4e745cc4fa6a389e6af428ac413aef19a
Author: Thomas Bruederli <bruederli at kolabsys.com>
Date:   Wed Feb 26 12:15:03 2014 +0100

    Decode escaped commas in various ical property values

diff --git a/plugins/libcalendaring/libvcalendar.php b/plugins/libcalendaring/libvcalendar.php
index 3d9be7a..52aa712 100644
--- a/plugins/libcalendaring/libvcalendar.php
+++ b/plugins/libcalendaring/libvcalendar.php
@@ -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':
diff --git a/plugins/libcalendaring/tests/libvcalendar.php b/plugins/libcalendaring/tests/libvcalendar.php
index 8526c5b..a74eaf3 100644
--- a/plugins/libcalendaring/tests/libvcalendar.php
+++ b/plugins/libcalendaring/tests/libvcalendar.php
@@ -208,6 +208,19 @@ class libvcalendar_test extends PHPUnit_Framework_TestCase
     }
 
     /**
+     * 
+     */
+    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
      */
     function test_freebusy()
diff --git a/plugins/libcalendaring/tests/resources/escaped.ics b/plugins/libcalendaring/tests/resources/escaped.ics
new file mode 100644
index 0000000..eb39a07
--- /dev/null
+++ b/plugins/libcalendaring/tests/resources/escaped.ics
@@ -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 at example.org
+DTSTAMP:20140225T160532Z
+ATTENDEE;CN="Master of Desaster";RSVP=TRUE;PARTSTAT=NEEDS-ACTION;
+ ROLE=REQ-PARTICIPANT;X-UID=100156408:mailto:master at desaster.com
+ATTENDEE;CN="John Doe";RSVP=TRUE;PARTSTAT=NEEDS-ACTION;
+ ROLE=REQ-PARTICIPANT;X-UID=115484392:mailto:doe at example.com
+ATTENDEE;CN="Thomas Kolab";RSVP=TRUE;PARTSTAT=NEEDS-ACTION;
+ ROLE=REQ-PARTICIPANT;X-UID=115936264:mailto:thomas at 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




More information about the commits mailing list