From 5cfeb49468b483394c12641c0004bd54ae4f2eab Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E8=80=97=E5=AD=90?= Date: Fri, 28 Jul 2023 04:12:06 +0800 Subject: [PATCH] fix(website): open_basedir --- app/http/controllers/website_controller.go | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/app/http/controllers/website_controller.go b/app/http/controllers/website_controller.go index 2489993b..ebb95b98 100644 --- a/app/http/controllers/website_controller.go +++ b/app/http/controllers/website_controller.go @@ -303,14 +303,15 @@ func (c *WebsiteController) SaveConfig(ctx http.Context) { raw = strings.Replace(raw, index, indexNew, -1) // 防跨站 - if !strings.HasSuffix(path, "/") { - path += "/" + root = ctx.Request().Input("root") + if !strings.HasSuffix(root, "/") { + root += "/" } if ctx.Request().InputBool("open_basedir") { - tools.WriteFile(path+".user.ini", "open_basedir="+path+":/tmp/", 0644) + tools.WriteFile(root+".user.ini", "open_basedir="+path+":/tmp/", 0644) } else { - if tools.Exists(path + ".user.ini") { - tools.RemoveFile(path + ".user.ini") + if tools.Exists(root + ".user.ini") { + tools.RemoveFile(root + ".user.ini") } }