From b56b34103e7fb5288f081ad4de0a2f07385ffbfb Mon Sep 17 00:00:00 2001 From: Jo Hasenau Date: Thu, 23 Oct 2025 01:11:12 +0200 Subject: [PATCH 1/4] Implement pagination for Dropbox folder entries Added pagination handling for Dropbox folder listing. --- Classes/Driver/DropboxDriver.php | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/Classes/Driver/DropboxDriver.php b/Classes/Driver/DropboxDriver.php index 5242e72..73e0654 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 (isset($listFolderResponse['has_more']) && $listFolderResponse['has_more'] === true) { + $cursor = $listFolderResponse['cursor'] ?? ''; + if (empty($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); } From 7788bc3bdec1a28a6656a3ec3193c2a1e758cb4e Mon Sep 17 00:00:00 2001 From: Jo Hasenau Date: Mon, 3 Nov 2025 10:03:30 +0100 Subject: [PATCH 2/4] Use suggested code style change MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Co-authored-by: Stefan Frömken --- Classes/Driver/DropboxDriver.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Classes/Driver/DropboxDriver.php b/Classes/Driver/DropboxDriver.php index 73e0654..756f917 100644 --- a/Classes/Driver/DropboxDriver.php +++ b/Classes/Driver/DropboxDriver.php @@ -729,7 +729,7 @@ protected function initializeFolder(FolderPathInfo $folderPathInfo): void } // Handle pagination if there are more entries - while (isset($listFolderResponse['has_more']) && $listFolderResponse['has_more'] === true) { + while ($listFolderResponse['has_more'] ?? false) { $cursor = $listFolderResponse['cursor'] ?? ''; if (empty($cursor)) { break; From cab85d76a48cc35949871d99b6cfae9da1591ad0 Mon Sep 17 00:00:00 2001 From: Jo Hasenau Date: Mon, 3 Nov 2025 10:04:32 +0100 Subject: [PATCH 3/4] Use suggested code style change MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Co-authored-by: Stefan Frömken --- Classes/Driver/DropboxDriver.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Classes/Driver/DropboxDriver.php b/Classes/Driver/DropboxDriver.php index 756f917..b6c62f2 100644 --- a/Classes/Driver/DropboxDriver.php +++ b/Classes/Driver/DropboxDriver.php @@ -731,7 +731,7 @@ protected function initializeFolder(FolderPathInfo $folderPathInfo): void // Handle pagination if there are more entries while ($listFolderResponse['has_more'] ?? false) { $cursor = $listFolderResponse['cursor'] ?? ''; - if (empty($cursor)) { + if ($cursor === '') { break; } From a2187ebb303d43ad0bd468b1193a010656f24e31 Mon Sep 17 00:00:00 2001 From: Jo Hasenau Date: Mon, 3 Nov 2025 10:05:22 +0100 Subject: [PATCH 4/4] Use suggested code style change MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Co-authored-by: Stefan Frömken --- Classes/Driver/DropboxDriver.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Classes/Driver/DropboxDriver.php b/Classes/Driver/DropboxDriver.php index b6c62f2..003b878 100644 --- a/Classes/Driver/DropboxDriver.php +++ b/Classes/Driver/DropboxDriver.php @@ -730,7 +730,7 @@ protected function initializeFolder(FolderPathInfo $folderPathInfo): void // Handle pagination if there are more entries while ($listFolderResponse['has_more'] ?? false) { - $cursor = $listFolderResponse['cursor'] ?? ''; + $cursor = string($listFolderResponse['cursor'] ?? ''); if ($cursor === '') { break; }