summaryrefslogtreecommitdiffstats
path: root/apps/dav
diff options
context:
space:
mode:
authorJoas Schilling <coding@schilljs.com>2020-03-12 11:25:47 +0100
committerGeorg Ehrke <developer@georgehrke.com>2020-04-15 15:49:36 +0200
commitbb754cb363ef4a7b5f0fd4a8a9c9baf1c699b571 (patch)
tree338c1da7324967f90db22d8c3b805fb54802fdbe /apps/dav
parent2e9f105786e99ac163ec3dcb3a6b89f0c2261097 (diff)
downloadnextcloud-server-bb754cb363ef4a7b5f0fd4a8a9c9baf1c699b571.tar.gz
nextcloud-server-bb754cb363ef4a7b5f0fd4a8a9c9baf1c699b571.zip
Always transform the etag and read the data
Signed-off-by: Joas Schilling <coding@schilljs.com>
Diffstat (limited to 'apps/dav')
-rw-r--r--apps/dav/lib/CardDAV/CardDavBackend.php2
-rw-r--r--apps/dav/tests/unit/CardDAV/CardDavBackendTest.php24
2 files changed, 14 insertions, 12 deletions
diff --git a/apps/dav/lib/CardDAV/CardDavBackend.php b/apps/dav/lib/CardDAV/CardDavBackend.php
index 7abfd64ed70..1f87ca5f7c1 100644
--- a/apps/dav/lib/CardDAV/CardDavBackend.php
+++ b/apps/dav/lib/CardDAV/CardDavBackend.php
@@ -994,6 +994,8 @@ class CardDavBackend implements BackendInterface, SyncSupport {
$queryResult->closeCursor();
if (is_array($contact)) {
+ $contact['etag'] = '"' . $contact['etag'] . '"';
+ $contact['carddata'] = $this->readBlob($contact['carddata']);
$result = $contact;
}
diff --git a/apps/dav/tests/unit/CardDAV/CardDavBackendTest.php b/apps/dav/tests/unit/CardDAV/CardDavBackendTest.php
index 1768acb39e0..5a6339d4261 100644
--- a/apps/dav/tests/unit/CardDAV/CardDavBackendTest.php
+++ b/apps/dav/tests/unit/CardDAV/CardDavBackendTest.php
@@ -630,7 +630,7 @@ class CardDavBackendTest extends TestCase {
$this->invokePrivate($this->backend, 'getCardId', [1, 'uri']));
}
-
+
public function testGetCardIdFailed() {
$this->expectException(\InvalidArgumentException::class);
@@ -690,15 +690,15 @@ class CardDavBackendTest extends TestCase {
);
$query->execute();
$query->insert($this->dbCardsPropertiesTable)
- ->values(
- [
- 'addressbookid' => $query->createNamedParameter(0),
- 'cardid' => $query->createNamedParameter($vCardIds[0]),
- 'name' => $query->createNamedParameter('CLOUD'),
- 'value' => $query->createNamedParameter('John@nextcloud.com'),
- 'preferred' => $query->createNamedParameter(0)
- ]
- );
+ ->values(
+ [
+ 'addressbookid' => $query->createNamedParameter(0),
+ 'cardid' => $query->createNamedParameter($vCardIds[0]),
+ 'name' => $query->createNamedParameter('CLOUD'),
+ 'value' => $query->createNamedParameter('John@nextcloud.com'),
+ 'preferred' => $query->createNamedParameter(0)
+ ]
+ );
$query->execute();
$query->insert($this->dbCardsPropertiesTable)
->values(
@@ -783,7 +783,7 @@ class CardDavBackendTest extends TestCase {
$this->assertSame('uri', $this->backend->getCardUri($id));
}
-
+
public function testGetCardUriFailed() {
$this->expectException(\InvalidArgumentException::class);
@@ -812,7 +812,7 @@ class CardDavBackendTest extends TestCase {
$this->assertSame(0, (int)$result['addressbookid']);
$this->assertSame('uri0', $result['uri']);
$this->assertSame(5489543, (int)$result['lastmodified']);
- $this->assertSame('etag0', $result['etag']);
+ $this->assertSame('"etag0"', $result['etag']);
$this->assertSame(120, (int)$result['size']);
// this shouldn't return any result because 'uri1' is in address book 1