mirror of
https://github.com/nextcloud/server.git
synced 2026-04-21 14:23:17 -04:00
Merge pull request #20431 from owncloud/carddav-enforce-displayname
When creating addressbooks, make sure the displayname is set
This commit is contained in:
commit
f77c6dbbed
2 changed files with 8 additions and 1 deletions
|
|
@ -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([
|
||||
|
|
|
|||
Loading…
Reference in a new issue