Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Actually return the root folder when traversing up the tree
If you now keep calling $node->getParent() you will at some point get
the RootFolder back. This is a nice termination check and will prevent
endless loops if an exit condition is slightly off.

Signed-off-by: Roeland Jago Douma <[email protected]>
  • Loading branch information
rullzer authored and Mikael Hammarin committed Oct 26, 2018
commit ce7a2117432b139551511fbb07805d3a9ddc2c67
6 changes: 5 additions & 1 deletion lib/private/Files/Node/Node.php
Original file line number Diff line number Diff line change
Expand Up @@ -266,7 +266,11 @@ public function isCreatable() {
* @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);
}

/**
Expand Down