From d65d58a1a2efb1c144ae35ef205f6098579ef69d Mon Sep 17 00:00:00 2001 From: lazerg Date: Sat, 31 Oct 2026 13:04:25 +0500 Subject: [PATCH] fix(files): skip listing children beyond the requested folder tree depth Assisted-by: Claude:claude-opus-5-5 Signed-off-by: lazerg --- apps/files/lib/Controller/ApiController.php | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) 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) {