summaryrefslogtreecommitdiffstats
path: root/services
diff options
context:
space:
mode:
authorLunny Xiao <xiaolunwen@gmail.com>2020-12-12 23:33:19 +0800
committerGitHub <noreply@github.com>2020-12-12 16:33:19 +0100
commit9f100a45c6f65d9f41f619d3c683361cad0f72fc (patch)
treea64326a18f120f07f1923316d93687d0dae32ebd /services
parent6074e13c8d26084bc74de38bb7414a971fd5fbf8 (diff)
downloadgitea-9f100a45c6f65d9f41f619d3c683361cad0f72fc.tar.gz
gitea-9f100a45c6f65d9f41f619d3c683361cad0f72fc.zip
Possible fix the webhook API creation (#13960)
* Possible fix the webhook API creation * Fix api create webhook bug
Diffstat (limited to 'services')
-rw-r--r--services/webhook/webhook.go7
1 files changed, 5 insertions, 2 deletions
diff --git a/services/webhook/webhook.go b/services/webhook/webhook.go
index a86d638ab5..b779b38466 100644
--- a/services/webhook/webhook.go
+++ b/services/webhook/webhook.go
@@ -60,12 +60,15 @@ var (
// RegisterWebhook registers a webhook
func RegisterWebhook(name string, webhook *webhook) {
- webhooks[models.HookTaskType(name)] = webhook
+ webhooks[models.HookTaskType(strings.TrimSpace(name))] = webhook
}
// IsValidHookTaskType returns true if a webhook registered
func IsValidHookTaskType(name string) bool {
- _, ok := webhooks[models.HookTaskType(name)]
+ if name == models.GITEA || name == models.GOGS {
+ return true
+ }
+ _, ok := webhooks[models.HookTaskType(strings.TrimSpace(name))]
return ok
}