1
1
mirror of https://github.com/go-gitea/gitea synced 2025-07-11 21:17:19 +00:00

Use correct has error check for internal responses (#28796) (#28798)

Backport #28796 by @wxiaoguang

`resp != nil` doesn't mean the request really succeeded. Add a comment
for requestJSONResp to clarify the behavior.

Co-authored-by: wxiaoguang <wxiaoguang@gmail.com>
This commit is contained in:
Giteabot
2024-01-15 20:13:35 +08:00
committed by GitHub
parent df694f6a7d
commit cbf366643b
4 changed files with 4 additions and 3 deletions

View File

@ -30,7 +30,7 @@ func SendEmail(ctx context.Context, subject, message string, to []string) (strin
})
resp, extra := requestJSONResp(req, &responseText{})
if resp == nil {
if extra.HasError() {
return "", extra
}
return resp.Text, extra