summaryrefslogtreecommitdiff
path: root/lib/Kolab/CardDAV/ContactsBackend.php
diff options
context:
space:
mode:
authorThomas Bruederli <bruederli@kolabsys.com>2014-05-06 14:28:51 (GMT)
committerThomas Bruederli <bruederli@kolabsys.com>2014-05-06 14:30:24 (GMT)
commite916334ac8fb840a1156fb7836349e95a6cc80fc (patch)
treee596f4503f64a4a7f6b087578c6445aeda891bdb /lib/Kolab/CardDAV/ContactsBackend.php
parent1a5d37bdc036f3d062d70cce59dde5988bbaafcc (diff)
downloadiRony-e916334ac8fb840a1156fb7836349e95a6cc80fc.tar.gz
Correctly encode and decode CalDAV/CardDAV object URIs (#3049)
Diffstat (limited to 'lib/Kolab/CardDAV/ContactsBackend.php')
-rw-r--r--lib/Kolab/CardDAV/ContactsBackend.php14
1 files changed, 7 insertions, 7 deletions
diff --git a/lib/Kolab/CardDAV/ContactsBackend.php b/lib/Kolab/CardDAV/ContactsBackend.php
index cb0c448..a025d7d 100644
--- a/lib/Kolab/CardDAV/ContactsBackend.php
+++ b/lib/Kolab/CardDAV/ContactsBackend.php
@@ -274,7 +274,7 @@ class ContactsBackend extends CardDAV\Backend\AbstractBackend
foreach ($storage->select($query) as $contact) {
$cards[] = array(
'id' => $contact['uid'],
- 'uri' => $contact['uid'] . '.vcf',
+ 'uri' => VObjectUtils::uid2uri($contact['uid'], '.vcf'),
'lastmodified' => is_a($contact['changed'], 'DateTime') ? $contact['changed']->format('U') : null,
'etag' => self::_get_etag($contact),
'size' => $contact['_size'],
@@ -299,7 +299,7 @@ class ContactsBackend extends CardDAV\Backend\AbstractBackend
{
console(__METHOD__, $addressBookId, $cardUri);
- $uid = basename($cardUri, '.vcf');
+ $uid = VObjectUtils::uri2uid($cardUri, '.vcf');
// search all folders for the given card
if ($addressBookId == '__all__') {
@@ -319,7 +319,7 @@ class ContactsBackend extends CardDAV\Backend\AbstractBackend
if ($contact) {
return array(
'id' => $contact['uid'],
- 'uri' => $contact['uid'] . '.vcf',
+ 'uri' => VObjectUtils::uid2uri($contact['uid'], '.vcf'),
'lastmodified' => is_a($contact['changed'], 'DateTime') ? $contact['changed']->format('U') : null,
'carddata' => $this->to_vcard($contact),
'etag' => self::_get_etag($contact),
@@ -356,7 +356,7 @@ class ContactsBackend extends CardDAV\Backend\AbstractBackend
{
console(__METHOD__, $addressBookId, $cardUri, $cardData);
- $uid = basename($cardUri, '.vcf');
+ $uid = VObjectUtils::uri2uid($cardUri, '.vcf');
$storage = $this->get_storage_folder($addressBookId);
$object = $this->parse_vcard($cardData, $uid);
@@ -365,7 +365,7 @@ class ContactsBackend extends CardDAV\Backend\AbstractBackend
}
// if URI doesn't match the content's UID, the object might already exist!
- $cardUri = $object['uid'] . '.vcf';
+ $cardUri = VObjectUtils::uid2uri($object['uid'], '.vcf');
if ($object['uid'] != $uid && $this->getCard($addressBookId, $cardUri)) {
Plugin::$redirect_basename = $cardUri;
return $this->updateCard($addressBookId, $cardUri, $cardData);
@@ -415,7 +415,7 @@ class ContactsBackend extends CardDAV\Backend\AbstractBackend
{
console(__METHOD__, $addressBookId, $cardUri, $cardData);
- $uid = basename($cardUri, '.vcf');
+ $uid = VObjectUtils::uri2uid($cardUri, '.vcf');
$object = $this->parse_vcard($cardData, $uid);
// sanity check
@@ -485,7 +485,7 @@ class ContactsBackend extends CardDAV\Backend\AbstractBackend
{
console(__METHOD__, $addressBookId, $cardUri);
- $uid = basename($cardUri, '.vcf');
+ $uid = VObjectUtils::uri2uid($cardUri, '.vcf');
if ($addressBookId == '__all__') {
$this->get_card_by_uid($uid, $storage);