Merge pull request #9321 from nextcloud/bugfix/noid/return_root_folder_when_at_root

Actually return the root folder when traversing up the tree
This commit is contained in:
Morris Jobke 2018-04-27 13:59:29 +02:00 committed by GitHub
commit 7306d30708
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -265,7 +265,11 @@ class Node implements \OCP\Files\Node {
* @return Node
*/
public function getParent() {
return $this->root->get(dirname($this->path));
$newPath = dirname($this->path);
if ($newPath === '' || $newPath === '.' || $newPath === '/') {
return $this->root;
}
return $this->root->get($newPath);
}
/**