summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMorris Jobke <hey@morrisjobke.de>2016-06-29 11:41:23 +0200
committerGitHub <noreply@github.com>2016-06-29 11:41:23 +0200
commitcf798edfecd4688858ed0abe42ff87ea3ef5dd60 (patch)
tree77dcfb1fee58c7f35b2dd5028eb4f524088d588e
parentb6397ef73a765be807efe363703f27013fd50d7a (diff)
parent5f6944954bcbd356dd1fe11ac1698bc8178cb84e (diff)
downloadnextcloud-server-cf798edfecd4688858ed0abe42ff87ea3ef5dd60.tar.gz
nextcloud-server-cf798edfecd4688858ed0abe42ff87ea3ef5dd60.zip
Merge pull request #242 from nextcloud/fix-229
get only vcard which match both the address book id and the vcard uri
-rw-r--r--apps/dav/lib/CardDAV/CardDavBackend.php2
-rw-r--r--apps/dav/tests/unit/CardDAV/CardDavBackendTest.php5
2 files changed, 6 insertions, 1 deletions
diff --git a/apps/dav/lib/CardDAV/CardDavBackend.php b/apps/dav/lib/CardDAV/CardDavBackend.php
index 2ad9f4778c9..39f76a4b420 100644
--- a/apps/dav/lib/CardDAV/CardDavBackend.php
+++ b/apps/dav/lib/CardDAV/CardDavBackend.php
@@ -848,7 +848,7 @@ class CardDavBackend implements BackendInterface, SyncSupport {
$query = $this->db->getQueryBuilder();
$query->select('*')->from($this->dbCardsTable)
->where($query->expr()->eq('uri', $query->createNamedParameter($uri)))
- ->where($query->expr()->eq('addressbookid', $query->createNamedParameter($addressBookId)));
+ ->andWhere($query->expr()->eq('addressbookid', $query->createNamedParameter($addressBookId)));
$queryResult = $query->execute();
$contact = $queryResult->fetch();
$queryResult->closeCursor();
diff --git a/apps/dav/tests/unit/CardDAV/CardDavBackendTest.php b/apps/dav/tests/unit/CardDAV/CardDavBackendTest.php
index 58a93befe68..9845d2d6909 100644
--- a/apps/dav/tests/unit/CardDAV/CardDavBackendTest.php
+++ b/apps/dav/tests/unit/CardDAV/CardDavBackendTest.php
@@ -606,6 +606,11 @@ class CardDavBackendTest extends TestCase {
$this->assertSame(5489543, (int)$result['lastmodified']);
$this->assertSame('etag0', $result['etag']);
$this->assertSame(120, (int)$result['size']);
+
+ // this shouldn't return any result because 'uri1' is in address book 1
+ // see https://github.com/nextcloud/server/issues/229
+ $result = $this->backend->getContact(0, 'uri1');
+ $this->assertEmpty($result);
}
public function testGetContactFail() {