From e10363c02a51e9c9f7d93ab412636428df54d235 Mon Sep 17 00:00:00 2001 From: ph0EnXx Date: Mon, 8 Aug 2016 04:46:47 -0400 Subject: [PATCH] Adding the directory argument for the listing. (#29) * Adding the directory argument for the listing . * strict check on directory for listing --- src/GoogleStorageAdapter.php | 5 +++++ 1 file changed, 5 insertions(+) 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();