diff --git a/apps/files_external/lib/Lib/Storage/AmazonS3.php b/apps/files_external/lib/Lib/Storage/AmazonS3.php index b455994359..00ca4a5b8a 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;