Skip to content

Commit

Permalink
Pass the marker to prevent the eternal loop
Browse files Browse the repository at this point in the history
  • Loading branch information
frankdejonge committed Apr 2, 2015
1 parent 1104887 commit c44e407
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion src/RackspaceAdapter.php
Original file line number Diff line number Diff line change
Expand Up @@ -223,16 +223,18 @@ public function readStream($path)
public function listContents($directory = '', $recursive = false)
{
$response = [];
$marker = null;
$location = $this->applyPathPrefix($directory);

while(true) {
$objectList = $this->container->objectList(['prefix' => $location]);
$objectList = $this->container->objectList(['prefix' => $location, 'marker' => $marker]);

if ($objectList->count() === 0) {
break;
}

$response = array_merge($response, iterator_to_array($objectList));
$marker = end($response)->getName();
}

return Util::emulateDirectories(array_map([$this, 'normalizeObject'], $response));
Expand Down

0 comments on commit c44e407

Please sign in to comment.