[Pkg-owncloud-commits] [php-sabredav] 170/275: Converting incoming jCard data from PUT.

David Prévot taffit at moszumanska.debian.org
Thu Sep 25 14:56:04 UTC 2014


This is an automated email from the git hooks/post-receive script.

taffit pushed a commit to branch master
in repository php-sabredav.

commit 3ca5e4ad086f26a416316271adc07f8abb30a8d2
Author: Evert Pot <me at evertpot.com>
Date:   Thu Aug 21 16:42:15 2014 -0400

    Converting incoming jCard data from PUT.
---
 lib/CardDAV/Plugin.php | 15 +++++++++++++--
 1 file changed, 13 insertions(+), 2 deletions(-)

diff --git a/lib/CardDAV/Plugin.php b/lib/CardDAV/Plugin.php
index 637ee8f..3ab28db 100644
--- a/lib/CardDAV/Plugin.php
+++ b/lib/CardDAV/Plugin.php
@@ -382,11 +382,22 @@ class Plugin extends DAV\ServerPlugin {
 
         try {
 
-            $vobj = VObject\Reader::read($data);
+            // If the data starts with a [, we can reasonably assume we're dealing
+            // with a jCal object.
+            if (substr($data,0,1)==='[') {
+                $vobj = VObject\Reader::readJson($data);
+
+                // Converting $data back to iCalendar, as that's what we
+                // technically support everywhere.
+                $data = $vobj->serialize();
+                $modified = true;
+            } else {
+                $vobj = VObject\Reader::read($data);
+            }
 
         } catch (VObject\ParseException $e) {
 
-            throw new DAV\Exception\UnsupportedMediaType('This resource only supports valid vcard data. Parse error: ' . $e->getMessage());
+            throw new DAV\Exception\UnsupportedMediaType('This resource only supports valid vCard or jCard data. Parse error: ' . $e->getMessage());
 
         }
 

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-owncloud/php-sabredav.git



More information about the Pkg-owncloud-commits mailing list