Skip to content

Commit

Permalink
Merge pull request #8842 from lanxenet/patch-1
Browse files Browse the repository at this point in the history
fix(AmazonS3):  fix loop $result['Contents'] error
  • Loading branch information
MorrisJobke authored May 7, 2018
2 parents 43c1e51 + 6212992 commit b348431
Showing 1 changed file with 10 additions and 8 deletions.
18 changes: 10 additions & 8 deletions apps/files_external/lib/Lib/Storage/AmazonS3.php
Original file line number Diff line number Diff line change
Expand Up @@ -291,15 +291,17 @@ public function opendir($path) {
$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;
}
}

Expand Down

0 comments on commit b348431

Please sign in to comment.