Skip to content

Commit

Permalink
fixed #37
Browse files Browse the repository at this point in the history
  • Loading branch information
overtrue committed Nov 14, 2023
1 parent 93da75c commit 0701a77
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 3 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -9,3 +9,4 @@ composer.lock
index.php
.phpunit.result.cache
.php-cs-fixer.cache
cghooks.lock
6 changes: 3 additions & 3 deletions src/CosAdapter.php
Original file line number Diff line number Diff line change
Expand Up @@ -201,7 +201,7 @@ public function visibility(string $path): FileAttributes
$meta = $this->getObjectClient()->getObjectACL($prefixedPath);

foreach ($meta['AccessControlPolicy']['AccessControlList']['Grant'] ?? [] as $grant) {
if ('READ' === $grant['Permission'] && str_contains($grant['Grantee']['URI'] ?? '', 'global/AllUsers')) {
if ($grant['Permission'] === 'READ' && str_contains($grant['Grantee']['URI'] ?? '', 'global/AllUsers')) {
return new FileAttributes($path, null, Visibility::PUBLIC);
}
}
Expand Down Expand Up @@ -423,10 +423,10 @@ protected function listObjects(string $directory = '', bool $recursive = false)
{
$result = $this->getBucketClient()->getObjects(
[
'prefix' => ('' === (string) $directory) ? '' : ($directory.'/'),
'prefix' => empty($directory) ? '' : ($directory.'/'),
'delimiter' => $recursive ? '' : '/',
]
)['ListBucketResult'];
)->toArray();

foreach (['CommonPrefixes', 'Contents'] as $key) {
$result[$key] = $result[$key] ?? [];
Expand Down

0 comments on commit 0701a77

Please sign in to comment.