From a60a13c60244251b06d3022b00f5a58c80108e31 Mon Sep 17 00:00:00 2001 From: Frank de Jonge Date: Sat, 22 Mar 2014 18:57:28 +0100 Subject: [PATCH] Added directory create check and handle actual directories in AWS content listing. --- src/Adapter/AwsS3.php | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/src/Adapter/AwsS3.php b/src/Adapter/AwsS3.php index 27b041e02..ef2a094c3 100644 --- a/src/Adapter/AwsS3.php +++ b/src/Adapter/AwsS3.php @@ -248,6 +248,10 @@ public function createDir($path) { $result = $this->write(rtrim($path, '/') . '/', ''); + if ( ! $result) { + return false; + } + return array('path' => $path, 'type' => 'dir'); } @@ -371,6 +375,13 @@ protected function normalizeObject($object, $path = null) $result['timestamp'] = strtotime($object['LastModified']); } + if (substr($result['path'], -1) === '/') { + $result['type'] = 'dir'; + $result['path'] = rtrim($result['path'], '/'); + + return $result; + } + $result = array_merge($result, Util::map($object, static::$resultMap), array('type' => 'file')); $result['dirname'] = Util::dirname($result['path']);