diff options
author | Björn Schießle <bjoern@schiessle.org> | 2016-06-29 12:13:59 +0200 |
---|---|---|
committer | Thomas Müller <DeepDiver1975@users.noreply.github.com> | 2016-06-29 12:13:59 +0200 |
commit | 5ace6b53f317630d0e99f55276e1f50e71037392 (patch) | |
tree | ae97b5fc47d18409f4047a17b7bd8a8e8d7b3456 | |
parent | 2b0f053126cbdce2bf18389c5bc0522ce7138824 (diff) | |
download | nextcloud-server-5ace6b53f317630d0e99f55276e1f50e71037392.tar.gz nextcloud-server-5ace6b53f317630d0e99f55276e1f50e71037392.zip |
get only vcards which match both the address book id and the vcard uri (#25294)
-rw-r--r-- | apps/dav/lib/CardDAV/CardDavBackend.php | 2 | ||||
-rw-r--r-- | apps/dav/tests/unit/CardDAV/CardDavBackendTest.php | 4 |
2 files changed, 5 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..203d4512a47 100644 --- a/apps/dav/tests/unit/CardDAV/CardDavBackendTest.php +++ b/apps/dav/tests/unit/CardDAV/CardDavBackendTest.php @@ -606,6 +606,10 @@ 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 + $result = $this->backend->getContact(0, 'uri1'); + $this->assertEmpty($result); } public function testGetContactFail() { |