summaryrefslogtreecommitdiffstats
path: root/apps
diff options
context:
space:
mode:
authorArthur Schiwon <blizzz@owncloud.com>2015-11-10 11:37:07 +0100
committerArthur Schiwon <blizzz@owncloud.com>2015-11-10 11:41:27 +0100
commit06d1685e75f88a2423c3bcdc71b79c95c806347c (patch)
tree7e6d9fb315663588999607dddcd5d017aead29e5 /apps
parentbdd396aa3d710de1ea26f9279610392e6edaffc2 (diff)
downloadnextcloud-server-06d1685e75f88a2423c3bcdc71b79c95c806347c.tar.gz
nextcloud-server-06d1685e75f88a2423c3bcdc71b79c95c806347c.zip
When creating addressbooks, make sure the displayname is set
Diffstat (limited to 'apps')
-rw-r--r--apps/dav/lib/carddav/carddavbackend.php8
-rw-r--r--apps/dav/tests/unit/carddav/carddavbackendtest.php1
2 files changed, 8 insertions, 1 deletions
diff --git a/apps/dav/lib/carddav/carddavbackend.php b/apps/dav/lib/carddav/carddavbackend.php
index 7b16262a680..b2597baedc6 100644
--- a/apps/dav/lib/carddav/carddavbackend.php
+++ b/apps/dav/lib/carddav/carddavbackend.php
@@ -134,7 +134,7 @@ class CardDavBackend implements BackendInterface, SyncSupport {
* @param string $principalUri
* @param string $url Just the 'basename' of the url.
* @param array $properties
- * @return void
+ * @throws BadRequest
*/
function createAddressBook($principalUri, $url, array $properties) {
$values = [
@@ -160,6 +160,12 @@ class CardDavBackend implements BackendInterface, SyncSupport {
}
+ // Fallback to make sure the displayname is set. Some clients may refuse
+ // to work with addressbooks not having a displayname.
+ if(is_null($values['displayname'])) {
+ $values['displayname'] = $url;
+ }
+
$query = $this->db->getQueryBuilder();
$query->insert('addressbooks')
->values([
diff --git a/apps/dav/tests/unit/carddav/carddavbackendtest.php b/apps/dav/tests/unit/carddav/carddavbackendtest.php
index f7456e9634c..79ef36d8097 100644
--- a/apps/dav/tests/unit/carddav/carddavbackendtest.php
+++ b/apps/dav/tests/unit/carddav/carddavbackendtest.php
@@ -60,6 +60,7 @@ class CardDavBackendTest extends TestCase {
$books = $this->backend->getAddressBooksForUser(self::UNIT_TEST_USER);
$this->assertEquals(1, count($books));
+ $this->assertEquals('Example', $books[0]['{DAV:}displayname']);
// update it's display name
$patch = new PropPatch([