From 160bd75d0ad59b3692ae2e904be52c9e4e7295f4 Mon Sep 17 00:00:00 2001 From: Julius Härtl Date: Sat, 18 Feb 2023 15:43:39 +0100 Subject: fix: Use proper path when creating node instances MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Julius Härtl --- apps/dav/lib/Connector/Sabre/Node.php | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) (limited to 'apps/dav/lib') diff --git a/apps/dav/lib/Connector/Sabre/Node.php b/apps/dav/lib/Connector/Sabre/Node.php index 2c8d313eefd..c9407b12786 100644 --- a/apps/dav/lib/Connector/Sabre/Node.php +++ b/apps/dav/lib/Connector/Sabre/Node.php @@ -91,11 +91,13 @@ abstract class Node implements \Sabre\DAV\INode { if ($info instanceof Folder || $info instanceof File) { $this->node = $info; } else { + // The Node API assumes that the view passed doesn't have a fake root + $rootView = \OC::$server->get(View::class); $root = \OC::$server->get(IRootFolder::class); if ($info->getType() === FileInfo::TYPE_FOLDER) { - $this->node = new Folder($root, $view, $this->path, $info); + $this->node = new Folder($root, $rootView, $this->fileView->getAbsolutePath($this->path), $info); } else { - $this->node = new File($root, $view, $this->path, $info); + $this->node = new File($root, $rootView, $this->fileView->getAbsolutePath($this->path), $info); } } } @@ -107,10 +109,11 @@ abstract class Node implements \Sabre\DAV\INode { } $this->info = $info; $root = \OC::$server->get(IRootFolder::class); + $rootView = \OC::$server->get(View::class); if ($this->info->getType() === FileInfo::TYPE_FOLDER) { - $this->node = new Folder($root, $this->fileView, $this->path, $this->info); + $this->node = new Folder($root, $rootView, $this->path, $this->info); } else { - $this->node = new File($root, $this->fileView, $this->path, $this->info); + $this->node = new File($root, $rootView, $this->path, $this->info); } } -- cgit v1.2.3