Skip to content

Commit

Permalink
Correct S3Client::ls_all
Browse files Browse the repository at this point in the history
  • Loading branch information
kohler committed Dec 4, 2024
1 parent e4257b5 commit 1b37fc7
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions lib/s3client.php
Original file line number Diff line number Diff line change
Expand Up @@ -545,7 +545,7 @@ function ls($prefix, $args = []) {
* @param array{start-after?:int|string,max-keys?:int,continuation-token?:void} $args
* @return Generator<SimpleXMLElement> */
function ls_all($prefix, $args = []) {
$max_keys = $args["max_keys"] ?? -1;
$max_keys = $args["max-keys"] ?? -1;
$xml = null;
$xmlpos = 0;
while ($max_keys !== 0) {
Expand All @@ -555,10 +555,10 @@ function ls_all($prefix, $args = []) {
$max_keys = max($max_keys - 1, -1);
continue;
}
if ($xml && !isset($args["continuation_token"])) {
if ($xml && !isset($args["continuation-token"])) {
break;
}
$args["max_keys"] = $max_keys < 0 ? 600 : min(600, $max_keys);
$args["max-keys"] = $max_keys < 0 ? 600 : min(600, $max_keys);
$content = $this->ls($prefix, $args);
$xml = new SimpleXMLElement($content);
$xmlpos = 0;
Expand All @@ -567,9 +567,9 @@ function ls_all($prefix, $args = []) {
throw new Exception("Bad response from S3 List Objects");
}
if (isset($xml->IsTruncated) && (string) $xml->IsTruncated === "true") {
$args["continuation_token"] = (string) $xml->NextContinuationToken;
$args["continuation-token"] = (string) $xml->NextContinuationToken;
} else {
unset($args["continuation_token"]);
unset($args["continuation-token"]);
}
}
}
Expand Down

0 comments on commit 1b37fc7

Please sign in to comment.