mirror of
https://github.com/go-gitea/gitea.git
synced 2024-05-11 05:55:29 +00:00
Possible fix the webhook API creation (#13960)
* Possible fix the webhook API creation * Fix api create webhook bug
This commit is contained in:
@ -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
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user