aboutsummaryrefslogtreecommitdiffstats
path: root/apps/dav/lib/Connector/Sabre/Node.php
diff options
context:
space:
mode:
authorRobin Appelman <robin@icewind.nl>2022-04-05 15:27:59 +0200
committerRobin Appelman <robin@icewind.nl>2022-04-06 14:40:31 +0200
commit9b1abd6fac90b97527c8db9d9119979c7753cb8c (patch)
treeb9c7a459936cf099c9aa65a8fa92fcd290816e80 /apps/dav/lib/Connector/Sabre/Node.php
parentef9890fb7857282f13a8c72def13475de1e1909e (diff)
downloadnextcloud-server-9b1abd6fac90b97527c8db9d9119979c7753cb8c.tar.gz
nextcloud-server-9b1abd6fac90b97527c8db9d9119979c7753cb8c.zip
save filesystem node in dav node
Signed-off-by: Robin Appelman <robin@icewind.nl>
Diffstat (limited to 'apps/dav/lib/Connector/Sabre/Node.php')
-rw-r--r--apps/dav/lib/Connector/Sabre/Node.php21
1 files changed, 21 insertions, 0 deletions
diff --git a/apps/dav/lib/Connector/Sabre/Node.php b/apps/dav/lib/Connector/Sabre/Node.php
index 79b4db0e327..79f1653c692 100644
--- a/apps/dav/lib/Connector/Sabre/Node.php
+++ b/apps/dav/lib/Connector/Sabre/Node.php
@@ -36,9 +36,12 @@
namespace OCA\DAV\Connector\Sabre;
use OC\Files\Mount\MoveableMount;
+use OC\Files\Node\File;
+use OC\Files\Node\Folder;
use OC\Files\View;
use OCA\DAV\Connector\Sabre\Exception\InvalidPath;
use OCP\Files\FileInfo;
+use OCP\Files\IRootFolder;
use OCP\Files\StorageNotAvailableException;
use OCP\Share\IShare;
use OCP\Share\Exceptions\ShareNotFound;
@@ -75,6 +78,8 @@ abstract class Node implements \Sabre\DAV\INode {
*/
protected $shareManager;
+ protected \OC\Files\Node\Node $node;
+
/**
* Sets up the node, expects a full path name
*
@@ -91,10 +96,22 @@ 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);
+ } else {
+ $this->node = new File($root, $view, $this->path, $info);
+ }
}
protected function refreshInfo() {
$this->info = $this->fileView->getFileInfo($this->path);
+ $root = \OC::$server->get(IRootFolder::class);
+ if ($this->info->getType() === FileInfo::TYPE_FOLDER) {
+ $this->node = new Folder($root, $this->fileView, $this->path, $this->info);
+ } else {
+ $this->node = new File($root, $this->fileView, $this->path, $this->info);
+ }
}
/**
@@ -403,6 +420,10 @@ abstract class Node implements \Sabre\DAV\INode {
return $this->info;
}
+ public function getNode(): \OCP\Files\Node {
+ return $this->node;
+ }
+
protected function sanitizeMtime($mtimeFromRequest) {
return MtimeSanitizer::sanitizeMtime($mtimeFromRequest);
}