diff --git a/src/Adapter.php b/src/Adapter.php index b4777f9..33d8487 100644 --- a/src/Adapter.php +++ b/src/Adapter.php @@ -271,12 +271,8 @@ public function deleteDir($dirname) return true; } - $keys = array_map(function ($item) { - return ['Key' => $item['Key']]; - }, (array) $response['Contents']); - // ignore directory - $keys = array_filter($keys, function ($item) { + $keys = array_filter((array) $response['Contents'], function ($item) { return substr($item['Key'], -1) !== '/'; }); @@ -284,6 +280,10 @@ public function deleteDir($dirname) return true; } + $keys = array_map(function ($item) { + return ['Key' => $item['Key']]; + }, $keys); + return (bool) $this->client->deleteObjects([ 'Bucket' => $this->getBucket(), 'Key' => $keys,