Skip to content

Commit

Permalink
修复证书文件判断错误
Browse files Browse the repository at this point in the history
  • Loading branch information
Jinnrry committed Jul 8, 2024
1 parent fbd9645 commit 402e001
Showing 1 changed file with 14 additions and 11 deletions.
25 changes: 14 additions & 11 deletions server/controllers/setup.go
Original file line number Diff line number Diff line change
Expand Up @@ -143,19 +143,22 @@ func Setup(ctx *context.Context, w http.ResponseWriter, req *http.Request) {
}

if reqData["step"] == "ssl" && reqData["action"] == "set" {
keyPath := reqData["key_path"]
crtPath := reqData["crt_path"]

_, err := os.Stat(keyPath)
if err != nil {
response.NewErrorResponse(response.ServerError, err.Error(), "").FPrint(w)
return
}
if reqData["ssl_type"] == config.SSLTypeUser {
keyPath := reqData["key_path"]
crtPath := reqData["crt_path"]

_, err = os.Stat(crtPath)
if err != nil {
response.NewErrorResponse(response.ServerError, err.Error(), "").FPrint(w)
return
_, err := os.Stat(keyPath)
if err != nil {
response.NewErrorResponse(response.ServerError, err.Error(), "").FPrint(w)
return
}

_, err = os.Stat(crtPath)
if err != nil {
response.NewErrorResponse(response.ServerError, err.Error(), "").FPrint(w)
return
}
}

err = ssl.SetSSL(reqData["ssl_type"], reqData["key_path"], reqData["crt_path"])
Expand Down

0 comments on commit 402e001

Please sign in to comment.