Skip to content
This repository has been archived by the owner on May 22, 2024. It is now read-only.

Commit

Permalink
Merge pull request thephpleague#298 from dormadekhin/master
Browse files Browse the repository at this point in the history
change deprecated ListObjects to ListObjectsV2
  • Loading branch information
frankdejonge authored Jul 2, 2022
2 parents 3668f4a + d75962e commit 8f3cc56
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 8 deletions.
12 changes: 6 additions & 6 deletions spec/AwsS3AdapterSpec.php
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand All @@ -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,
Expand All @@ -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,
Expand Down Expand Up @@ -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' => '/'
Expand Down Expand Up @@ -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' => '/'
Expand Down Expand Up @@ -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,
Expand Down
4 changes: 2 additions & 2 deletions src/AwsS3Adapter.php
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand Down Expand Up @@ -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, '/') . '/',
Expand Down

0 comments on commit 8f3cc56

Please sign in to comment.