diff options
author | Julius Härtl <jus@bitgrid.net> | 2023-02-18 15:43:39 +0100 |
---|---|---|
committer | Simon L <szaimen@e.mail.de> | 2023-04-17 23:46:52 +0200 |
commit | 160bd75d0ad59b3692ae2e904be52c9e4e7295f4 (patch) | |
tree | f2edd76f77c54c6d356ea14ab5e6b141716da01f /lib/private/Files/Node | |
parent | 85c9e75f33c0c46bc33023d1f4af05f149d480c3 (diff) | |
download | nextcloud-server-160bd75d0ad59b3692ae2e904be52c9e4e7295f4.tar.gz nextcloud-server-160bd75d0ad59b3692ae2e904be52c9e4e7295f4.zip |
fix: Use proper path when creating node instances
Signed-off-by: Julius Härtl <jus@bitgrid.net>
Diffstat (limited to 'lib/private/Files/Node')
-rw-r--r-- | lib/private/Files/Node/Node.php | 6 |
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; |