mirror of
https://github.com/go-gitea/gitea
synced 2025-07-03 09:07:19 +00:00
rsponse 404 when delete not exist email (#15383)
fix #15357 Signed-off-by: a1012112796 <1012112796@qq.com>
This commit is contained in:
@ -111,6 +111,8 @@ func DeleteEmail(ctx *context.APIContext) {
|
||||
// responses:
|
||||
// "204":
|
||||
// "$ref": "#/responses/empty"
|
||||
// "404":
|
||||
// "$ref": "#/responses/notFound"
|
||||
form := web.GetForm(ctx).(*api.DeleteEmailOption)
|
||||
if len(form.Emails) == 0 {
|
||||
ctx.Status(http.StatusNoContent)
|
||||
@ -126,6 +128,10 @@ func DeleteEmail(ctx *context.APIContext) {
|
||||
}
|
||||
|
||||
if err := models.DeleteEmailAddresses(emails); err != nil {
|
||||
if models.IsErrEmailAddressNotExist(err) {
|
||||
ctx.Error(http.StatusNotFound, "DeleteEmailAddresses", err)
|
||||
return
|
||||
}
|
||||
ctx.Error(http.StatusInternalServerError, "DeleteEmailAddresses", err)
|
||||
return
|
||||
}
|
||||
|
Reference in New Issue
Block a user