mirror of https://github.com/1Panel-dev/1Panel
fix: 解决同名反向代理失败导致文件被删除的问题 (#910)
parent
a0c329019f
commit
95ad101a08
|
@ -1195,12 +1195,14 @@ func (w WebsiteService) OperateProxy(req request.WebsiteProxyConfig) (err error)
|
|||
}
|
||||
fileName := fmt.Sprintf("%s.conf", req.Name)
|
||||
includePath := path.Join(includeDir, fileName)
|
||||
if !fileOp.Stat(includePath) {
|
||||
_ = fileOp.CreateFile(includePath)
|
||||
}
|
||||
backName := fmt.Sprintf("%s.bak", req.Name)
|
||||
backPath := path.Join(includeDir, backName)
|
||||
|
||||
if req.Operate == "create" && (fileOp.Stat(includePath) || fileOp.Stat(backPath)) {
|
||||
err = buserr.New(constant.ErrNameIsExist)
|
||||
return
|
||||
}
|
||||
|
||||
defer func() {
|
||||
if err != nil {
|
||||
switch req.Operate {
|
||||
|
|
Loading…
Reference in New Issue