aboutsummaryrefslogtreecommitdiffstats
path: root/apps/dav/lib/carddav
diff options
context:
space:
mode:
authorJoas Schilling <nickvergessen@owncloud.com>2016-01-21 12:19:28 +0100
committerJoas Schilling <nickvergessen@owncloud.com>2016-01-21 12:19:28 +0100
commitdf27a939ce76c06a1a1f1ecf0525c62553ac4f0a (patch)
treea74680301c98f92f410aa8fc117d018cd2c14e1d /apps/dav/lib/carddav
parent50b303f3add4cc7ff8747f0e0fc4d0ac885fcd76 (diff)
downloadnextcloud-server-df27a939ce76c06a1a1f1ecf0525c62553ac4f0a.tar.gz
nextcloud-server-df27a939ce76c06a1a1f1ecf0525c62553ac4f0a.zip
No card ID when deleting is acceptable
Diffstat (limited to 'apps/dav/lib/carddav')
-rw-r--r--apps/dav/lib/carddav/carddavbackend.php10
1 files changed, 8 insertions, 2 deletions
diff --git a/apps/dav/lib/carddav/carddavbackend.php b/apps/dav/lib/carddav/carddavbackend.php
index 7b8c43958b6..97067abb7c3 100644
--- a/apps/dav/lib/carddav/carddavbackend.php
+++ b/apps/dav/lib/carddav/carddavbackend.php
@@ -536,7 +536,11 @@ class CardDavBackend implements BackendInterface, SyncSupport {
* @return bool
*/
function deleteCard($addressBookId, $cardUri) {
- $cardId = $this->getCardId($cardUri);
+ try {
+ $cardId = $this->getCardId($cardUri);
+ } catch (\InvalidArgumentException $e) {
+ $cardId = null;
+ }
$query = $this->db->getQueryBuilder();
$ret = $query->delete('cards')
->where($query->expr()->eq('addressbookid', $query->createNamedParameter($addressBookId)))
@@ -546,7 +550,9 @@ class CardDavBackend implements BackendInterface, SyncSupport {
$this->addChange($addressBookId, $cardUri, 3);
if ($ret === 1) {
- $this->purgeProperties($addressBookId, $cardId);
+ if ($cardId !== null) {
+ $this->purgeProperties($addressBookId, $cardId);
+ }
return true;
}