Skip to content

Commit 7306d30

Browse files
authored
Merge pull request #9321 from nextcloud/bugfix/noid/return_root_folder_when_at_root
Actually return the root folder when traversing up the tree
2 parents 21da359 + 235e348 commit 7306d30

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

lib/private/Files/Node/Node.php

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -265,7 +265,11 @@ public function isCreatable() {
265265
* @return Node
266266
*/
267267
public function getParent() {
268-
return $this->root->get(dirname($this->path));
268+
$newPath = dirname($this->path);
269+
if ($newPath === '' || $newPath === '.' || $newPath === '/') {
270+
return $this->root;
271+
}
272+
return $this->root->get($newPath);
269273
}
270274

271275
/**

0 commit comments

Comments
 (0)