diff options
Diffstat (limited to 'apps/dav')
-rw-r--r-- | apps/dav/lib/carddav/carddavbackend.php | 8 | ||||
-rw-r--r-- | apps/dav/lib/connector/sabre/serverfactory.php | 3 | ||||
-rw-r--r-- | apps/dav/lib/server.php | 2 | ||||
-rw-r--r-- | apps/dav/tests/unit/carddav/carddavbackendtest.php | 1 |
4 files changed, 13 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/lib/connector/sabre/serverfactory.php b/apps/dav/lib/connector/sabre/serverfactory.php index b62f90ab802..f67e949e802 100644 --- a/apps/dav/lib/connector/sabre/serverfactory.php +++ b/apps/dav/lib/connector/sabre/serverfactory.php @@ -78,6 +78,9 @@ class ServerFactory { // wait with registering these until auth is handled and the filesystem is setup $server->on('beforeMethod', function () use ($server, $objectTree, $viewCallBack) { + // ensure the skeleton is copied + \OC::$server->getUserFolder(); + /** @var \OC\Files\View $view */ $view = $viewCallBack(); $rootInfo = $view->getFileInfo(''); diff --git a/apps/dav/lib/server.php b/apps/dav/lib/server.php index 22171b74d37..a92c9980f54 100644 --- a/apps/dav/lib/server.php +++ b/apps/dav/lib/server.php @@ -35,6 +35,8 @@ class Server { $this->server->addPlugin(new \Sabre\DAVACL\Plugin()); + $this->server->addPlugin(new \Sabre\CardDAV\Plugin()); + // wait with registering these until auth is handled and the filesystem is setup $this->server->on('beforeMethod', function () { // custom properties plugin must be the last one 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([ |