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']);