diff options
author | Arthur Schiwon <blizzz@arthur-schiwon.de> | 2021-04-30 21:36:05 +0200 |
---|---|---|
committer | backportbot[bot] <backportbot[bot]@users.noreply.github.com> | 2021-05-03 13:56:02 +0000 |
commit | c41a916250322f4c9e5d72fb9a76357829b9b61b (patch) | |
tree | 2dac64ebb2f06d375056069e87db17d37ad7c1bc /apps/dav/lib/CardDAV | |
parent | 47148762c8b08c8275c4d08502b229a7d1b6218b (diff) | |
download | nextcloud-server-c41a916250322f4c9e5d72fb9a76357829b9b61b.tar.gz nextcloud-server-c41a916250322f4c9e5d72fb9a76357829b9b61b.zip |
fix creating vcards with multiple string values
Internally it is valid to provide multiple values for a property as
plain string. An exampe is given in the PhpDoc of
AddressBookImpl::search().
Signed-off-by: Arthur Schiwon <blizzz@arthur-schiwon.de>
Diffstat (limited to 'apps/dav/lib/CardDAV')
-rw-r--r-- | apps/dav/lib/CardDAV/AddressBookImpl.php | 18 |
1 files changed, 11 insertions, 7 deletions
diff --git a/apps/dav/lib/CardDAV/AddressBookImpl.php b/apps/dav/lib/CardDAV/AddressBookImpl.php index a2895fed34a..e270b579e1f 100644 --- a/apps/dav/lib/CardDAV/AddressBookImpl.php +++ b/apps/dav/lib/CardDAV/AddressBookImpl.php @@ -150,13 +150,17 @@ class AddressBookImpl implements IAddressBook { if (is_array($value)) { $vCard->remove($key); foreach ($value as $entry) { - if (($key === "ADR" || $key === "PHOTO") && is_string($entry["value"])) { - $entry["value"] = stripslashes($entry["value"]); - $entry["value"] = explode(';', $entry["value"]); - } - $property = $vCard->createProperty($key, $entry["value"]); - if (isset($entry["type"])) { - $property->add('TYPE', $entry["type"]); + if (is_string($entry)) { + $property = $vCard->createProperty($key, $entry); + } else { + if (($key === "ADR" || $key === "PHOTO") && is_string($entry["value"])) { + $entry["value"] = stripslashes($entry["value"]); + $entry["value"] = explode(';', $entry["value"]); + } + $property = $vCard->createProperty($key, $entry["value"]); + if (isset($entry["type"])) { + $property->add('TYPE', $entry["type"]); + } } $vCard->add($property); } |