summaryrefslogtreecommitdiffstats
path: root/apps
diff options
context:
space:
mode:
authorMorris Jobke <hey@morrisjobke.de>2016-06-30 17:43:46 +0200
committerGitHub <noreply@github.com>2016-06-30 17:43:46 +0200
commit23cc465b0d610aada816963fbfa66b10443f3567 (patch)
treebf7c0213527cadd965f4e9233775db2cc71a3720 /apps
parenteed6c6a8b9a17e2eb290b9db76ebdbb8429336b1 (diff)
parent6a61cc0e35c9f3dbdd6c769a6f0964274eaf5515 (diff)
downloadnextcloud-server-23cc465b0d610aada816963fbfa66b10443f3567.tar.gz
nextcloud-server-23cc465b0d610aada816963fbfa66b10443f3567.zip
Merge pull request #254 from nextcloud/fix-229-stable9
[stable9] get only vcard which match both the address book id and the vcard uri
Diffstat (limited to 'apps')
-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 97f5706049a..64c251980c6 100644
--- a/apps/dav/lib/carddav/carddavbackend.php
+++ b/apps/dav/lib/carddav/carddavbackend.php
@@ -845,7 +845,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 1ee09260c88..50f8769581d 100644
--- a/apps/dav/tests/unit/carddav/carddavbackendtest.php
+++ b/apps/dav/tests/unit/carddav/carddavbackendtest.php
@@ -605,6 +605,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() {