summaryrefslogtreecommitdiffstats
path: root/apps/files_external
diff options
context:
space:
mode:
authorMorris Jobke <hey@morrisjobke.de>2018-05-07 18:41:39 +0200
committerGitHub <noreply@github.com>2018-05-07 18:41:39 +0200
commitb348431bce472b3e354b675b7647e33b51b1633b (patch)
tree9012c080ee15adb43e671027c280124c5750be2c /apps/files_external
parent43c1e51a5fe204e6148f84fe3bf26490ed5db91f (diff)
parent6212992c0a030a4768a217cc2b1fb93931e7ffdd (diff)
downloadnextcloud-server-b348431bce472b3e354b675b7647e33b51b1633b.tar.gz
nextcloud-server-b348431bce472b3e354b675b7647e33b51b1633b.zip
Merge pull request #8842 from lanxenet/patch-1
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 483f1610bcb..097b196b2d4 100644
--- a/apps/files_external/lib/Lib/Storage/AmazonS3.php
+++ b/apps/files_external/lib/Lib/Storage/AmazonS3.php
@@ -291,15 +291,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;
}
}