Possible fix the webhook API creation (#13960)
* Possible fix the webhook API creation * Fix api create webhook bug
This commit is contained in:
parent
6074e13c8d
commit
9f100a45c6
2 changed files with 7 additions and 3 deletions
|
@ -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
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue