summaryrefslogtreecommitdiffstats
path: root/apps/files_external/lib
diff options
context:
space:
mode:
authorRoeland Jago Douma <roeland@famdouma.nl>2020-10-23 12:40:12 +0200
committerbackportbot[bot] <backportbot[bot]@users.noreply.github.com>2020-10-27 11:00:27 +0000
commit2cafd81d233015982a118ad7767ec53fc9f853fb (patch)
tree754e2e8d2bb09e6ad6bc95954b57b7e60d974f71 /apps/files_external/lib
parent238435f9b56803b226704e3ea9e37cf5931c61bb (diff)
downloadnextcloud-server-2cafd81d233015982a118ad7767ec53fc9f853fb.tar.gz
nextcloud-server-2cafd81d233015982a118ad7767ec53fc9f853fb.zip
Check if array elements exist before using them
It seems that in some recent upgrade here. Not always the entries we expect are returned. So we should first check if they exist. As to not spam the log. Signed-off-by: Roeland Jago Douma <roeland@famdouma.nl>
Diffstat (limited to 'apps/files_external/lib')
-rw-r--r--apps/files_external/lib/Lib/Storage/AmazonS3.php8
1 files changed, 7 insertions, 1 deletions
diff --git a/apps/files_external/lib/Lib/Storage/AmazonS3.php b/apps/files_external/lib/Lib/Storage/AmazonS3.php
index b4559943594..00ca4a5b8a8 100644
--- a/apps/files_external/lib/Lib/Storage/AmazonS3.php
+++ b/apps/files_external/lib/Lib/Storage/AmazonS3.php
@@ -164,7 +164,13 @@ class AmazonS3 extends \OC\Files\Storage\Common {
'MaxKeys' => 1,
'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) {
if ($e->getStatusCode() === 403) {
$this->directoryCache[$path] = false;