From 0d9e57d3da4c499b670ca4f8fc4f0f7e22a15449 Mon Sep 17 00:00:00 2001 From: qwerty287 <80460567+qwerty287@users.noreply.github.com> Date: Thu, 8 Aug 2024 07:50:38 +0200 Subject: [PATCH] Drop repo name fallback for hooks (#4013) --- docs/docs/91-migrations.md | 10 ++-------- server/api/hook.go | 9 +++------ 2 files changed, 5 insertions(+), 14 deletions(-) diff --git a/docs/docs/91-migrations.md b/docs/docs/91-migrations.md index d9af52e34..9e8603be8 100644 --- a/docs/docs/91-migrations.md +++ b/docs/docs/91-migrations.md @@ -2,14 +2,6 @@ Some versions need some changes to the server configuration or the pipeline configuration files. - - ## `next` - Removed `WOODPECKER_DEV_OAUTH_HOST` and `WOODPECKER_DEV_GITEA_OAUTH_URL` use `WOODPECKER_EXPERT_FORGE_OAUTH_HOST` @@ -26,6 +18,8 @@ Some versions need some changes to the server configuration or the pipeline conf - Removed `WOODPECKER_WEBHOOK_HOST` in favor of `WOODPECKER_EXPERT_WEBHOOK_HOST` - Migrated to rfc9421 for webhook signatures - Renamed `start_time`, `end_time`, `created_at`, `started_at`, `finished_at` and `reviewed_at` JSON fields to `started`, `finished`, `created`, `started`, `finished`, `reviewed` +- Update all webhooks by pressing the "Repair all" button in the admin settings as the webhook token claims have changed +- Crons now use standard Linux syntax without seconds ## 2.0.0 diff --git a/server/api/hook.go b/server/api/hook.go index 654acc93d..713fca39b 100644 --- a/server/api/hook.go +++ b/server/api/hook.go @@ -250,11 +250,8 @@ func PostHook(c *gin.Context) { func getRepoFromToken(store store.Store, t *token.Token) (*model.Repo, error) { // try to get the repo by the repo-id repoID, err := strconv.ParseInt(t.Get("repo-id"), 10, 64) - if err == nil { - return store.GetRepo(repoID) + if err != nil { + return nil, err } - - // try to get the repo by the repo name or by its redirection - repoName := t.Get("text") - return store.GetRepoName(repoName) + return store.GetRepo(repoID) }