@@ -247,9 +247,11 @@ public function getRecentFiles() {
247247
248248 /**
249249 * @param \OCP\Files\Node[] $nodes
250+ * @param ?non-empty-string $mimeTypeFilter limit returned content to this mimetype or mimepart
250251 * @param int $depth The depth to traverse into the contents of each node
252+ * @return FilesFolderTree
251253 */
252- private function getChildren (array $ nodes , int $ depth = 1 , int $ currentDepth = 0 ): array {
254+ private function getChildren (array $ nodes , int $ depth = 1 , int $ currentDepth = 0 , ? string $ mimeTypeFilter = null ): array {
253255 if ($ currentDepth >= $ depth ) {
254256 return [];
255257 }
@@ -264,14 +266,15 @@ private function getChildren(array $nodes, int $depth = 1, int $currentDepth = 0
264266 $ entry = [
265267 'id ' => $ node ->getId (),
266268 'basename ' => $ basename ,
267- 'children ' => $ this ->getChildren ($ node ->getDirectoryListing (), $ depth , $ currentDepth + 1 ),
269+ 'children ' => $ this ->getChildren ($ node ->getDirectoryListing ($ mimeTypeFilter ), $ depth , $ currentDepth + 1 ),
268270 ];
269271 $ displayName = $ node ->getName ();
270272 if ($ basename !== $ displayName ) {
271273 $ entry ['displayName ' ] = $ displayName ;
272274 }
273275 $ children [] = $ entry ;
274276 }
277+ /** @var FilesFolderTree $children */
275278 return $ children ;
276279 }
277280
@@ -308,8 +311,8 @@ public function getFolderTree(string $path = '/', int $depth = 1): JSONResponse
308311 'message ' => $ this ->l10n ->t ('Invalid folder path ' ),
309312 ], Http::STATUS_BAD_REQUEST );
310313 }
311- $ nodes = $ node ->getDirectoryListing ();
312- $ tree = $ this ->getChildren ($ nodes , $ depth );
314+ $ nodes = $ node ->getDirectoryListing (' httpd/unix-directory ' );
315+ $ tree = $ this ->getChildren ($ nodes , $ depth, 0 , ' httpd/unix-directory ' );
313316 } catch (NotFoundException $ e ) {
314317 return new JSONResponse ([
315318 'message ' => $ this ->l10n ->t ('Folder not found ' ),
0 commit comments