diff --git a/Classes/Driver/DropboxDriver.php b/Classes/Driver/DropboxDriver.php index 5242e72..003b878 100644 --- a/Classes/Driver/DropboxDriver.php +++ b/Classes/Driver/DropboxDriver.php @@ -719,6 +719,7 @@ protected function initializeFolder(FolderPathInfo $folderPathInfo): void $folderPathInfo->getPath() ); + // Process initial entries foreach ($listFolderResponse['entries'] ?? [] as $metaData) { $entry = $this->pathInfoFactory->createPathInfo($metaData); $folderPathInfo->addEntry($entry); @@ -727,6 +728,22 @@ protected function initializeFolder(FolderPathInfo $folderPathInfo): void $this->cachePathInfo($entry); } + // Handle pagination if there are more entries + while ($listFolderResponse['has_more'] ?? false) { + $cursor = string($listFolderResponse['cursor'] ?? ''); + if ($cursor === '') { + break; + } + + $listFolderResponse = $this->dropboxClient->getClient()->listFolderContinue($cursor); + + foreach ($listFolderResponse['entries'] ?? [] as $metaData) { + $entry = $this->pathInfoFactory->createPathInfo($metaData); + $folderPathInfo->addEntry($entry); + $this->cachePathInfo($entry); + } + } + // Update cache entry for folder with all its files and folders $this->cachePathInfo($folderPathInfo); }