From e1ae5373868f30221ef03e0257dc6ab6b141bc94 Mon Sep 17 00:00:00 2001 From: junleea <354425203@qq.com> Date: Fri, 3 Jan 2025 16:11:16 +0800 Subject: [PATCH] =?UTF-8?q?=E6=B7=BB=E5=8A=A0=E7=94=A8=E6=88=B7=E7=BC=93?= =?UTF-8?q?=E5=AD=98=E5=8F=8A=E6=9B=B4=E6=96=B0=EF=BC=8C=E6=B7=BB=E5=8A=A0?= =?UTF-8?q?=E9=85=8D=E7=BD=AE=E6=96=87=E4=BB=B6=E5=A2=9E=E5=88=A0=E6=94=B9?= =?UTF-8?q?=E6=9F=A5=E6=8E=A5=E5=8F=A3=EF=BC=8C=E6=B7=BB=E5=8A=A0=E6=96=87?= =?UTF-8?q?=E4=BB=B6=E5=8A=9F=E8=83=BD.=E6=B7=BB=E5=8A=A0=E9=85=8D?= =?UTF-8?q?=E7=BD=AE=E6=96=87=E4=BB=B6=E6=B7=BB=E5=8A=A0=E8=AF=B7=E6=B1=82?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- service/fileService.go | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/service/fileService.go b/service/fileService.go index 78a5351..8940b76 100644 --- a/service/fileService.go +++ b/service/fileService.go @@ -82,6 +82,10 @@ func CreateConfigFile(req *proto.AddConfigFileReq, userId int) error { err = fmt.Errorf("user not found or no permission") return err } + if req.FileName == "" || req.FilePath == "" { + err = fmt.Errorf("file name or file path is empty") + return err + } //查看系统中是否存在文件,不存在则创建 file := req.FilePath + "/" + req.FileName //正则判断文件名是否合法