summaryrefslogtreecommitdiffstats
path: root/apps
diff options
context:
space:
mode:
authorRoeland Jago Douma <rullzer@users.noreply.github.com>2020-10-27 11:55:37 +0100
committerGitHub <noreply@github.com>2020-10-27 11:55:37 +0100
commit25f347a49a4ccbe8903de05c9e56d5d0940faf92 (patch)
tree26fd71abed5c8c6d1a32a5120c5c2f21e42ee72d /apps
parentd38a7c6710227a17a6bbd2a3e423668c202b57c3 (diff)
parentb7be09ab2cd2790a6182c6b3f6c038cc2767683c (diff)
downloadnextcloud-server-25f347a49a4ccbe8903de05c9e56d5d0940faf92.tar.gz
nextcloud-server-25f347a49a4ccbe8903de05c9e56d5d0940faf92.zip
Merge pull request #23645 from nextcloud/fix/fe/s3/isset_first
Check if array elements exist before using them
Diffstat (limited to 'apps')
-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 4510de8b6ec..3cdff1d6f40 100644
--- a/apps/files_external/lib/Lib/Storage/AmazonS3.php
+++ b/apps/files_external/lib/Lib/Storage/AmazonS3.php
@@ -165,7 +165,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;