summaryrefslogtreecommitdiffstats
path: root/apps/files_external
diff options
context:
space:
mode:
authorMorris Jobke <hey@morrisjobke.de>2018-05-29 20:56:03 +0200
committerGitHub <noreply@github.com>2018-05-29 20:56:03 +0200
commitb71c90bac1cc5367bee3dfd067f2f28372253256 (patch)
tree23cb16c86f6e6ce06d392ab37fc434dbb1b7cbd3 /apps/files_external
parentd6ab2a4ddbb10c9b35e90ee13aca6bb5d10e2d45 (diff)
parent65bb12032d263e1449f0058886261cf2ac8a2a59 (diff)
downloadnextcloud-server-b71c90bac1cc5367bee3dfd067f2f28372253256.tar.gz
nextcloud-server-b71c90bac1cc5367bee3dfd067f2f28372253256.zip
Merge pull request #9650 from nextcloud/backport/8842/stable13
[stable13] fix(AmazonS3): fix loop $result['Contents'] error
Diffstat (limited to 'apps/files_external')
-rw-r--r--apps/files_external/lib/Lib/Storage/AmazonS3.php18
1 files changed, 10 insertions, 8 deletions
diff --git a/apps/files_external/lib/Lib/Storage/AmazonS3.php b/apps/files_external/lib/Lib/Storage/AmazonS3.php
index cc9cdc08138..cf79e05c9c3 100644
--- a/apps/files_external/lib/Lib/Storage/AmazonS3.php
+++ b/apps/files_external/lib/Lib/Storage/AmazonS3.php
@@ -292,15 +292,17 @@ class AmazonS3 extends \OC\Files\Storage\Common {
$files[] = substr(trim($prefix['Prefix'], '/'), strlen($path));
}
}
- foreach ($result['Contents'] as $object) {
- if (isset($object['Key']) && $object['Key'] === $path) {
- // it's the directory itself, skip
- continue;
+ if (is_array($result['Contents'])) {
+ foreach ($result['Contents'] as $object) {
+ if (isset($object['Key']) && $object['Key'] === $path) {
+ // it's the directory itself, skip
+ continue;
+ }
+ $file = basename(
+ isset($object['Key']) ? $object['Key'] : $object['Prefix']
+ );
+ $files[] = $file;
}
- $file = basename(
- isset($object['Key']) ? $object['Key'] : $object['Prefix']
- );
- $files[] = $file;
}
}