From aac907887ba375d0bd8be4dc647e42624e5d8f08 Mon Sep 17 00:00:00 2001 From: liuende501 Date: Sat, 9 Oct 2021 09:37:54 +0800 Subject: [PATCH] Optimized testing client which create the directory again when the directory does not exist. (#4119) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Co-authored-by: 李铭昕 <715557344@qq.com> --- src/Client.php | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/Client.php b/src/Client.php index cfaecbd..3717f8d 100644 --- a/src/Client.php +++ b/src/Client.php @@ -231,7 +231,9 @@ protected function normalizeFiles(array $multipart): array $dir = BASE_PATH . '/runtime/uploads'; $tmpName = $dir . '/' . $filename; - $fileSystem->makeDirectory($dir); + if (! is_dir($dir)) { + $fileSystem->makeDirectory($dir); + } $fileSystem->put($tmpName, $contents); $stats = fstat($contents);