diff options
author | Simon L <szaimen@e.mail.de> | 2023-04-18 04:11:44 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2023-04-18 04:11:44 +0200 |
commit | 855e7a2efb377653d0ce50ff9c0e43ec27612413 (patch) | |
tree | 35c17a4cb706b29d03b4a1a866ac0f7d997b5355 /lib/private/Files | |
parent | e10e509452de7f69c64e394a652b46a6ca2cbd95 (diff) | |
parent | d9c81f56ad25d6665e87468cf18dc2646334fb3b (diff) | |
download | nextcloud-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.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; |