Set delimiter so that the CommonPrefixes response can properly be determined

Signed-off-by: Julius Härtl <jus@bitgrid.net>
This commit is contained in:
Julius Härtl 2020-09-09 15:19:04 +02:00 committed by backportbot[bot]
parent 30ea77c673
commit b946d2c444
1 changed files with 2 additions and 1 deletions

View File

@ -162,8 +162,9 @@ class AmazonS3 extends \OC\Files\Storage\Common {
'Bucket' => $this->bucket,
'Prefix' => rtrim($path, '/'),
'MaxKeys' => 1,
'Delimiter' => '/',
]);
$this->directoryCache[$path] = $result['Contents'] || $result['CommonPrefixes'];
$this->directoryCache[$path] = ($result['Contents'][0]['Key'] === rtrim($path, '/') . '/') || $result['CommonPrefixes'];
} catch (S3Exception $e) {
if ($e->getStatusCode() === 403) {
$this->directoryCache[$path] = false;