]> source.dussan.org Git - nextcloud-server.git/commitdiff
Always transform the etag and read the data
authorJoas Schilling <coding@schilljs.com>
Thu, 12 Mar 2020 10:25:47 +0000 (11:25 +0100)
committerGeorg Ehrke <developer@georgehrke.com>
Wed, 15 Apr 2020 13:49:36 +0000 (15:49 +0200)
Signed-off-by: Joas Schilling <coding@schilljs.com>
apps/dav/lib/CardDAV/CardDavBackend.php
apps/dav/tests/unit/CardDAV/CardDavBackendTest.php

index 7abfd64ed708b74e192fb1530272eacc32cb7edf..1f87ca5f7c1275d9e770dabbb3c5c016b12fad75 100644 (file)
@@ -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;
                }
 
index 1768acb39e0beb50148552f08aaf56c7cd1eb3a1..5a6339d42613297763fa7eacdc3f386f88fc321f 100644 (file)
@@ -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