From 85997100ed0dbd691cf0a4f35347366012bcad4f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E8=80=97=E5=AD=90?= Date: Thu, 1 Dec 2022 20:19:59 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E5=A4=8D=EF=BC=88=E7=BD=91=E7=AB=99?= =?UTF-8?q?=EF=BC=89=EF=BC=9A=E7=9B=AE=E5=BD=95=E5=BF=85=E9=A1=BB=E4=B8=BA?= =?UTF-8?q?/=E5=BC=80=E5=A4=B4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/Http/Controllers/Api/WebsitesController.php | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/app/Http/Controllers/Api/WebsitesController.php b/app/Http/Controllers/Api/WebsitesController.php index 2270ba21..3bfaf749 100644 --- a/app/Http/Controllers/Api/WebsitesController.php +++ b/app/Http/Controllers/Api/WebsitesController.php @@ -101,6 +101,13 @@ class WebsitesController extends Controller if (empty($credentials['path'])) { $credentials['path'] = '/www/wwwroot/'.$credentials['name']; } + // 如果path不以/开头,则返回错误 + if (!str_starts_with($credentials['path'], '/')) { + return response()->json([ + 'code' => 1, + 'msg' => '网站路径必须以/开头' + ]); + } // ssl默认设置为0 $credentials['ssl'] = 0; // 运行状态默认设置为1