diff --git a/apps/files/lib/Controller/ApiController.php b/apps/files/lib/Controller/ApiController.php index dac95e914aa76..b2fbfd4e34db2 100644 --- a/apps/files/lib/Controller/ApiController.php +++ b/apps/files/lib/Controller/ApiController.php @@ -275,7 +275,9 @@ private function getChildren(array $nodes, int $depth = 1, int $currentDepth = 0 $entry = [ 'id' => $node->getId(), 'basename' => $basename, - 'children' => $this->getChildren($node->getDirectoryListing($mimeTypeFilter), $depth, $currentDepth + 1), + 'children' => $currentDepth + 1 < $depth + ? $this->getChildren($node->getDirectoryListing($mimeTypeFilter), $depth, $currentDepth + 1) + : [], ]; $displayName = $node->getName(); if ($basename !== $displayName) {