Merge pull request #8842 from lanxenet/patch-1

fix(AmazonS3):  fix loop $result['Contents'] error
This commit is contained in:
Morris Jobke 2018-05-07 18:41:39 +02:00 committed by GitHub
commit b348431bce
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 10 additions and 8 deletions

View File

@ -291,6 +291,7 @@ class AmazonS3 extends \OC\Files\Storage\Common {
$files[] = substr(trim($prefix['Prefix'], '/'), strlen($path)); $files[] = substr(trim($prefix['Prefix'], '/'), strlen($path));
} }
} }
if (is_array($result['Contents'])) {
foreach ($result['Contents'] as $object) { foreach ($result['Contents'] as $object) {
if (isset($object['Key']) && $object['Key'] === $path) { if (isset($object['Key']) && $object['Key'] === $path) {
// it's the directory itself, skip // it's the directory itself, skip
@ -302,6 +303,7 @@ class AmazonS3 extends \OC\Files\Storage\Common {
$files[] = $file; $files[] = $file;
} }
} }
}
return IteratorDirectory::wrap($files); return IteratorDirectory::wrap($files);
} catch (S3Exception $e) { } catch (S3Exception $e) {