diff options
author | Robin Appelman <robin@icewind.nl> | 2022-04-05 15:29:49 +0200 |
---|---|---|
committer | Robin Appelman <robin@icewind.nl> | 2022-04-06 14:40:34 +0200 |
commit | 151c80039751bbe74042d7f6f5d58e9f115064e4 (patch) | |
tree | 6345e06bc32e6b8392bc63f10bca1a35f5ee75c6 /apps/dav | |
parent | 9b1abd6fac90b97527c8db9d9119979c7753cb8c (diff) | |
download | nextcloud-server-151c80039751bbe74042d7f6f5d58e9f115064e4.tar.gz nextcloud-server-151c80039751bbe74042d7f6f5d58e9f115064e4.zip |
allow reusing known folder info when getting directory contents
Signed-off-by: Robin Appelman <robin@icewind.nl>
Diffstat (limited to 'apps/dav')
-rw-r--r-- | apps/dav/lib/Connector/Sabre/Directory.php | 4 | ||||
-rw-r--r-- | apps/dav/lib/Connector/Sabre/Node.php | 14 |
2 files changed, 11 insertions, 7 deletions
diff --git a/apps/dav/lib/Connector/Sabre/Directory.php b/apps/dav/lib/Connector/Sabre/Directory.php index 54ee14fdaf3..8b616b0cb8a 100644 --- a/apps/dav/lib/Connector/Sabre/Directory.php +++ b/apps/dav/lib/Connector/Sabre/Directory.php @@ -236,7 +236,7 @@ class Directory extends \OCA\DAV\Connector\Sabre\Node implements \Sabre\DAV\ICol throw new \Sabre\DAV\Exception\NotFound('File with name ' . $path . ' could not be located'); } - if ($info['mimetype'] === 'httpd/unix-directory') { + if ($info->getMimeType() === FileInfo::MIMETYPE_FOLDER) { $node = new \OCA\DAV\Connector\Sabre\Directory($this->fileView, $info, $this->tree, $this->shareManager); } else { $node = new \OCA\DAV\Connector\Sabre\File($this->fileView, $info, $this->shareManager); @@ -264,7 +264,7 @@ class Directory extends \OCA\DAV\Connector\Sabre\Node implements \Sabre\DAV\ICol // the caller believe that the collection itself does not exist throw new Forbidden('No read permissions'); } - $folderContent = $this->fileView->getDirectoryContent($this->path); + $folderContent = $this->getNode()->getDirectoryListing(); } catch (LockedException $e) { throw new Locked(); } diff --git a/apps/dav/lib/Connector/Sabre/Node.php b/apps/dav/lib/Connector/Sabre/Node.php index 79f1653c692..e4517068f42 100644 --- a/apps/dav/lib/Connector/Sabre/Node.php +++ b/apps/dav/lib/Connector/Sabre/Node.php @@ -78,7 +78,7 @@ abstract class Node implements \Sabre\DAV\INode { */ protected $shareManager; - protected \OC\Files\Node\Node $node; + protected \OCP\Files\Node $node; /** * Sets up the node, expects a full path name @@ -96,11 +96,15 @@ abstract class Node implements \Sabre\DAV\INode { } else { $this->shareManager = \OC::$server->getShareManager(); } - $root = \OC::$server->get(IRootFolder::class); - if ($info->getType()=== FileInfo::TYPE_FOLDER) { - $this->node = new Folder($root, $view, $this->path, $info); + if ($info instanceof Folder || $info instanceof File) { + $this->node = $info; } else { - $this->node = new File($root, $view, $this->path, $info); + $root = \OC::$server->get(IRootFolder::class); + if ($info->getType() === FileInfo::TYPE_FOLDER) { + $this->node = new Folder($root, $view, $this->path, $info); + } else { + $this->node = new File($root, $view, $this->path, $info); + } } } |