aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRoeland Jago Douma <roeland@famdouma.nl>2020-10-23 12:40:12 +0200
committerMorris Jobke <hey@morrisjobke.de>2020-10-25 22:03:40 +0100
commitb7be09ab2cd2790a6182c6b3f6c038cc2767683c (patch)
tree0bbc6dc2e2653bf89bbf1796b0669c40a527ae0a
parent9976e47035e5e6707421f4beedc6fe47489a3333 (diff)
downloadnextcloud-server-b7be09ab2cd2790a6182c6b3f6c038cc2767683c.tar.gz
nextcloud-server-b7be09ab2cd2790a6182c6b3f6c038cc2767683c.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>
-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;