[PR #365] [MERGED] Bug fix for edit-hook API endpoint #15337

Closed
opened 2025-11-02 11:44:19 -06:00 by GiteaMirror · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/go-gitea/gitea/pull/365
Author: @ethantkoenig
Created: 12/7/2016
Status: Merged
Merged: 12/9/2016
Merged by: @bkcsoft

Base: masterHead: api/fix


📝 Commits (1)

  • 50de5f3 Bug fix for edit-hook API endpoint

📊 Changes

1 file changed (+8 additions, -2 deletions)

View changed files

📝 routers/api/v1/repo/hook.go (+8 -2)

📄 Description

This fixes a bug in the PATCH /repos/:ownername/:reponame/hooks/:id API endpoint. Previously the response contained old information about the webhook; for instance, if a webhook had a url of urlA, and I made a request to update the url to urlB, the returned JSON object previously would have a "url" field of urlA, not urlB.

Now the response contains the updated information (e.g. urlB).

I wasn't able to figure out a way to fix this without doing another call to models.GetWebhookByRepoID; if you find a way to avoid the second call, please let me know!


🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.

## 📋 Pull Request Information **Original PR:** https://github.com/go-gitea/gitea/pull/365 **Author:** [@ethantkoenig](https://github.com/ethantkoenig) **Created:** 12/7/2016 **Status:** ✅ Merged **Merged:** 12/9/2016 **Merged by:** [@bkcsoft](https://github.com/bkcsoft) **Base:** `master` ← **Head:** `api/fix` --- ### 📝 Commits (1) - [`50de5f3`](https://github.com/go-gitea/gitea/commit/50de5f3a9c702442804bd4de04126ae538bc768e) Bug fix for edit-hook API endpoint ### 📊 Changes **1 file changed** (+8 additions, -2 deletions) <details> <summary>View changed files</summary> 📝 `routers/api/v1/repo/hook.go` (+8 -2) </details> ### 📄 Description This fixes a bug in the `PATCH /repos/:ownername/:reponame/hooks/:id` API endpoint. Previously the response contained old information about the webhook; for instance, if a webhook had a url of `urlA`, and I made a request to update the url to `urlB`, the returned JSON object previously would have a `"url"` field of `urlA`, not `urlB`. Now the response contains the updated information (e.g. `urlB`). I wasn't able to figure out a way to fix this without doing another call to `models.GetWebhookByRepoID`; if you find a way to avoid the second call, please let me know! --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
GiteaMirror added the pull-request label 2025-11-02 11:44:19 -06:00
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: github-starred/gitea#15337