Skip to content
Snippets Groups Projects
Commit f77c6dbb authored by Thomas Müller's avatar Thomas Müller
Browse files

Merge pull request #20431 from owncloud/carddav-enforce-displayname

When creating addressbooks, make sure the displayname is set
parents cc432131 06d1685e
Branches
No related tags found
No related merge requests found
......@@ -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([
......
......@@ -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([
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment