Skip to content

Commit

Permalink
Fixed #16
Browse files Browse the repository at this point in the history
  • Loading branch information
overtrue committed Mar 4, 2021
1 parent 72e07cf commit 6263051
Showing 1 changed file with 9 additions and 1 deletion.
10 changes: 9 additions & 1 deletion src/CosAdapter.php
Original file line number Diff line number Diff line change
Expand Up @@ -400,10 +400,18 @@ protected function normalizeFileInfo(array $content)
*/
protected function listObjects($directory = '', $recursive = false)
{
return $this->getBucketClient()->getObjects([
$result = $this->getBucketClient()->getObjects([
'prefix' => ('' === (string) $directory) ? '' : ($directory.'/'),
'delimiter' => $recursive ? '' : '/',
])['ListBucketResult'];

$result['Contents'] = $result['Contents'] ?? [];

if (($key = \key($result['Contents'])) !== 0) {
$result['Contents'] = \is_null($key) ? [] : [$result['Contents']];
}

return $result;
}

/**
Expand Down

0 comments on commit 6263051

Please sign in to comment.