diff --git a/src/GoogleStorageAdapter.php b/src/GoogleStorageAdapter.php index 8fd34e8..0dd75b7 100644 --- a/src/GoogleStorageAdapter.php +++ b/src/GoogleStorageAdapter.php @@ -284,6 +284,11 @@ public function listContents($directory = '', $recursive = false) if ($pageToken) { $params['pageToken'] = $pageToken; } + + if (trim($directory) !== '') { + $params['prefix'] = $directory.'/'; + } + $objects = $this->service->objects->listObjects($this->bucket, $params); $results = array_merge($results, $objects->getItems()); $pageToken = $objects->getNextPageToken();