Merge pull request #23714 from nextcloud/backport/23645/stable19
[stable19] Check if array elements exist before using them
This commit is contained in:
commit
93bc5ea744
|
@ -164,7 +164,13 @@ class AmazonS3 extends \OC\Files\Storage\Common {
|
||||||
'MaxKeys' => 1,
|
'MaxKeys' => 1,
|
||||||
'Delimiter' => '/',
|
'Delimiter' => '/',
|
||||||
]);
|
]);
|
||||||
$this->directoryCache[$path] = ($result['Contents'][0]['Key'] === rtrim($path, '/') . '/') || $result['CommonPrefixes'];
|
|
||||||
|
if ((isset($result['Contents'][0]['Key']) && $result['Contents'][0]['Key'] === rtrim($path, '/') . '/')
|
||||||
|
|| isset($result['CommonPrefixes'])) {
|
||||||
|
$this->directoryCache[$path] = true;
|
||||||
|
} else {
|
||||||
|
$this->directoryCache[$path] = false;
|
||||||
|
}
|
||||||
} catch (S3Exception $e) {
|
} catch (S3Exception $e) {
|
||||||
if ($e->getStatusCode() === 403) {
|
if ($e->getStatusCode() === 403) {
|
||||||
$this->directoryCache[$path] = false;
|
$this->directoryCache[$path] = false;
|
||||||
|
|
Loading…
Reference in New Issue