From d75962eef01fbf774ce6d6b6855bcb7985de64ae Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=D0=94=D0=BE=D1=80=D0=BC=D0=B0=D0=B4=D0=B5=D1=85=D0=B8?= =?UTF-8?q?=D0=BD=20=D0=94=D0=B5=D0=BD=D0=B8=D1=81=20=D0=98=D0=B3=D0=BE?= =?UTF-8?q?=D1=80=D0=B5=D0=B2=D0=B8=D1=87?= Date: Tue, 17 May 2022 20:23:44 +0700 Subject: [PATCH] change deprecated ListObjects to ListObjectsV2 --- spec/AwsS3AdapterSpec.php | 12 ++++++------ src/AwsS3Adapter.php | 4 ++-- 2 files changed, 8 insertions(+), 8 deletions(-) diff --git a/spec/AwsS3AdapterSpec.php b/spec/AwsS3AdapterSpec.php index fc8fb78..28078f1 100644 --- a/spec/AwsS3AdapterSpec.php +++ b/spec/AwsS3AdapterSpec.php @@ -194,7 +194,7 @@ public function it_should_return_true_when_prefix_exists($command) ]); $this->client->doesObjectExist($this->bucket, self::PATH_PREFIX.'/'.$key, [])->willReturn(false); - $this->client->getCommand('listObjects', [ + $this->client->getCommand('ListObjectsV2', [ 'Bucket' => $this->bucket, 'Prefix' => self::PATH_PREFIX.'/'.$key.'/', 'MaxKeys' => 1, @@ -213,7 +213,7 @@ public function it_should_return_false_when_listing_objects_returns_a_403($comma $key = 'directory'; $this->client->doesObjectExist($this->bucket, self::PATH_PREFIX.'/'.$key, [])->willReturn(false); - $this->client->getCommand('listObjects', [ + $this->client->getCommand('ListObjectsV2', [ 'Bucket' => $this->bucket, 'Prefix' => self::PATH_PREFIX.'/'.$key.'/', 'MaxKeys' => 1, @@ -237,7 +237,7 @@ public function it_should_pass_through_when_listing_objects_throws_an_exception( $key = 'directory'; $this->client->doesObjectExist($this->bucket, self::PATH_PREFIX.'/'.$key, [])->willReturn(false); - $this->client->getCommand('listObjects', [ + $this->client->getCommand('ListObjectsV2', [ 'Bucket' => $this->bucket, 'Prefix' => self::PATH_PREFIX.'/'.$key.'/', 'MaxKeys' => 1, @@ -336,7 +336,7 @@ public function it_should_list_contents() ] ]); - $this->client->getPaginator('ListObjects', [ + $this->client->getPaginator('ListObjectsV2', [ 'Bucket' => $this->bucket, 'Prefix' => self::PATH_PREFIX.'/'.$prefix.'/', 'Delimiter' => '/' @@ -503,7 +503,7 @@ public function it_should_return_path_in_response_without_prefix($command) $this->make_it_read_a_file($command, 'read', ''); $this->read($key)->shouldHaveKeyWithValue('path', $key); - $this->client->getPaginator('ListObjects', [ + $this->client->getPaginator('ListObjectsV2', [ 'Bucket' => $this->bucket, 'Prefix' => self::PATH_PREFIX.'/'.$dir.'/', 'Delimiter' => '/' @@ -735,7 +735,7 @@ private function make_it_404_on_has_object($headCommand, $listCommand, $key) $this->client->doesObjectExist($this->bucket, self::PATH_PREFIX.'/'.$key, [])->willReturn(false); $result = new Result(); - $this->client->getCommand('listObjects', [ + $this->client->getCommand('ListObjectsV2', [ 'Bucket' => $this->bucket, 'Prefix' => self::PATH_PREFIX.'/'.$key.'/', 'MaxKeys' => 1, diff --git a/src/AwsS3Adapter.php b/src/AwsS3Adapter.php index ed9e90e..16b1eac 100644 --- a/src/AwsS3Adapter.php +++ b/src/AwsS3Adapter.php @@ -287,7 +287,7 @@ public function listContents($directory = '', $recursive = false) */ protected function retrievePaginatedListing(array $options) { - $resultPaginator = $this->s3Client->getPaginator('ListObjects', $options); + $resultPaginator = $this->s3Client->getPaginator('ListObjectsV2', $options); $listing = []; foreach ($resultPaginator as $result) { @@ -700,7 +700,7 @@ protected function doesDirectoryExist($location) // Maybe this isn't an actual key, but a prefix. // Do a prefix listing of objects to determine. $command = $this->s3Client->getCommand( - 'listObjects', + 'ListObjectsV2', [ 'Bucket' => $this->bucket, 'Prefix' => rtrim($location, '/') . '/',