loading up the forgejo repo on tangled to test page performance
0
fork

Configure Feed

Select the types of activity you want to include in your feed.

Return `404` in the API if the requested webhooks were not found (#24823)

Should resolve first point of the issue
https://github.com/go-gitea/gitea/issues/24574

authored by

Yevhen Pavlov and committed by
GitHub
1dfaf837 6b33152b

+7 -2
+7 -2
routers/api/v1/admin/hooks.go
··· 4 4 package admin 5 5 6 6 import ( 7 + "errors" 7 8 "net/http" 8 9 9 10 "code.gitea.io/gitea/models/webhook" ··· 74 75 hookID := ctx.ParamsInt64(":id") 75 76 hook, err := webhook.GetSystemOrDefaultWebhook(ctx, hookID) 76 77 if err != nil { 77 - ctx.Error(http.StatusInternalServerError, "GetSystemOrDefaultWebhook", err) 78 + if errors.Is(err, util.ErrNotExist) { 79 + ctx.NotFound() 80 + } else { 81 + ctx.Error(http.StatusInternalServerError, "GetSystemOrDefaultWebhook", err) 82 + } 78 83 return 79 84 } 80 85 h, err := webhook_service.ToHook("/admin/", hook) ··· 160 165 161 166 hookID := ctx.ParamsInt64(":id") 162 167 if err := webhook.DeleteDefaultSystemWebhook(ctx, hookID); err != nil { 163 - if webhook.IsErrWebhookNotExist(err) { 168 + if errors.Is(err, util.ErrNotExist) { 164 169 ctx.NotFound() 165 170 } else { 166 171 ctx.Error(http.StatusInternalServerError, "DeleteDefaultSystemWebhook", err)