diff options
Diffstat (limited to 'apps/dav/lib/Direct/DirectHome.php')
-rw-r--r-- | apps/dav/lib/Direct/DirectHome.php | 18 |
1 files changed, 15 insertions, 3 deletions
diff --git a/apps/dav/lib/Direct/DirectHome.php b/apps/dav/lib/Direct/DirectHome.php index 05c72aa0057..3440a55dc18 100644 --- a/apps/dav/lib/Direct/DirectHome.php +++ b/apps/dav/lib/Direct/DirectHome.php @@ -24,6 +24,8 @@ declare(strict_types=1); namespace OCA\DAV\Direct; +use OCA\DAV\Db\DirectMapper; +use OCP\AppFramework\Db\DoesNotExistException; use OCP\Files\File; use OCP\Files\IRootFolder; use Sabre\DAV\Exception\Forbidden; @@ -35,8 +37,12 @@ class DirectHome implements ICollection { /** @var IRootFolder */ private $rootFolder; - public function __construct(IRootFolder $rootFolder) { + /** @var DirectMapper */ + private $mapper; + + public function __construct(IRootFolder $rootFolder, DirectMapper $mapper) { $this->rootFolder = $rootFolder; + $this->mapper = $mapper; } function createFile($name, $data = null) { @@ -47,8 +53,14 @@ class DirectHome implements ICollection { throw new Forbidden(); } - function getChild($name) { - throw new NotFound(); + public function getChild($name) { + try { + $direct = $this->mapper->getByToken($name); + + return new DirectFile($direct, $this->rootFolder); + } catch (DoesNotExistException $e) { + throw new NotFound(); + } } function getChildren() { |