Browse Source

Merge pull request #8842 from lanxenet/patch-1

fix(AmazonS3):  fix loop $result['Contents'] error
pull/9412/head
Morris Jobke 8 years ago
committed by GitHub
parent
commit
b348431bce
No known key found for this signature in database GPG Key ID: 4AEE18F83AFDEB23
  1. 18
      apps/files_external/lib/Lib/Storage/AmazonS3.php

18
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;
}
}

Loading…
Cancel
Save