aboutsummaryrefslogtreecommitdiffstats
path: root/lib/private/Files
diff options
context:
space:
mode:
authorSimon L <szaimen@e.mail.de>2023-04-18 04:11:44 +0200
committerGitHub <noreply@github.com>2023-04-18 04:11:44 +0200
commit855e7a2efb377653d0ce50ff9c0e43ec27612413 (patch)
tree35c17a4cb706b29d03b4a1a866ac0f7d997b5355 /lib/private/Files
parente10e509452de7f69c64e394a652b46a6ca2cbd95 (diff)
parentd9c81f56ad25d6665e87468cf18dc2646334fb3b (diff)
downloadnextcloud-server-855e7a2efb377653d0ce50ff9c0e43ec27612413.tar.gz
nextcloud-server-855e7a2efb377653d0ce50ff9c0e43ec27612413.zip
Merge pull request #36774 from nextcloud/bugfix/noid/sabre-nodes
fix: always use proper path on node api when calling the view
Diffstat (limited to 'lib/private/Files')
-rw-r--r--lib/private/Files/Node/Node.php6
1 files changed, 5 insertions, 1 deletions
diff --git a/lib/private/Files/Node/Node.php b/lib/private/Files/Node/Node.php
index 2f88cc3a15a..0eef2716141 100644
--- a/lib/private/Files/Node/Node.php
+++ b/lib/private/Files/Node/Node.php
@@ -37,6 +37,7 @@ use OCP\Files\InvalidPathException;
use OCP\Files\NotFoundException;
use OCP\Files\NotPermittedException;
use OCP\Lock\LockedException;
+use OCP\PreConditionNotMetException;
use Symfony\Component\EventDispatcher\GenericEvent;
// FIXME: this class really should be abstract
@@ -52,7 +53,7 @@ class Node implements \OCP\Files\Node {
protected $root;
/**
- * @var string $path
+ * @var string $path Absolute path to the node (e.g. /admin/files/folder/file)
*/
protected $path;
@@ -72,6 +73,9 @@ class Node implements \OCP\Files\Node {
* @param FileInfo $fileInfo
*/
public function __construct($root, $view, $path, $fileInfo = null, ?Node $parent = null, bool $infoHasSubMountsIncluded = true) {
+ if (Filesystem::normalizePath($view->getRoot()) !== '/') {
+ throw new PreConditionNotMetException('The view passed to the node should not have any fake root set');
+ }
$this->view = $view;
$this->root = $root;
$this->path = $path;