diff --git a/src/Vinelab/Cdn/Providers/AwsS3Provider.php b/src/Vinelab/Cdn/Providers/AwsS3Provider.php index 8c45720..21216db 100755 --- a/src/Vinelab/Cdn/Providers/AwsS3Provider.php +++ b/src/Vinelab/Cdn/Providers/AwsS3Provider.php @@ -380,16 +380,16 @@ private function getFilesAlreadyOnBucket($assets) { $filesOnAWS = new Collection([]); - $files = $this->s3_client->listObjects([ - 'Bucket' => $this->getBucket(), + $files = $this->s3_client->getIterator('ListObjects', [ + 'Bucket' => $this->getBucket() ]); - if (!$files['Contents']) { + if (empty($files) || !$files->current()) { //no files on bucket. lets upload everything found. return $assets; } - foreach($files['Contents'] as $file) { + foreach($files as $file) { $a = ['Key' => $file['Key'], "LastModified" => $file['LastModified']->getTimestamp(), 'Size' => $file['Size']]; $filesOnAWS->put($file['Key'], $a); }