Browse Source

fix: 解决同名反向代理失败导致文件被删除的问题 (#910)

pull/919/head
zhengkunwang223 2 years ago committed by GitHub
parent
commit
95ad101a08
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 8
      backend/app/service/website.go

8
backend/app/service/website.go

@ -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…
Cancel
Save