summaryrefslogtreecommitdiffstats
path: root/services/webhook
diff options
context:
space:
mode:
authorLunny Xiao <xiaolunwen@gmail.com>2021-01-06 23:11:23 +0800
committerGitHub <noreply@github.com>2021-01-06 16:11:23 +0100
commit9f73cae6358c9647cf64589eb2ce055f3dd07f38 (patch)
tree8ed003cd1434f46c3fc5d3aa518084eb4bdb30a6 /services/webhook
parentd2ee1221cc7f52c8063e764b6515fbe4e83db517 (diff)
downloadgitea-9f73cae6358c9647cf64589eb2ce055f3dd07f38.tar.gz
gitea-9f73cae6358c9647cf64589eb2ce055f3dd07f38.zip
Fix wrong type on hooktask to convert typ from char(16) to varchar(16) (#14148)
* Fix wrong type on hooktask to convert typ from char(16) to varchar(16) * Fix bugs * Improve code * Use different trim function for MSSQL * Fix bug * Removed wrong changed line * Removed wrong changed line * Fix nullable * Fix lint * Ignore sqlite on migration * Fix mssql modify column failure * Move modifyColumn to migrations.go so that other migrate function could use it
Diffstat (limited to 'services/webhook')
-rw-r--r--services/webhook/webhook.go6
1 files changed, 3 insertions, 3 deletions
diff --git a/services/webhook/webhook.go b/services/webhook/webhook.go
index b779b38466..7b6bc555f7 100644
--- a/services/webhook/webhook.go
+++ b/services/webhook/webhook.go
@@ -60,7 +60,7 @@ var (
// RegisterWebhook registers a webhook
func RegisterWebhook(name string, webhook *webhook) {
- webhooks[models.HookTaskType(strings.TrimSpace(name))] = webhook
+ webhooks[models.HookTaskType(name)] = webhook
}
// IsValidHookTaskType returns true if a webhook registered
@@ -68,7 +68,7 @@ func IsValidHookTaskType(name string) bool {
if name == models.GITEA || name == models.GOGS {
return true
}
- _, ok := webhooks[models.HookTaskType(strings.TrimSpace(name))]
+ _, ok := webhooks[models.HookTaskType(name)]
return ok
}
@@ -147,7 +147,7 @@ func prepareWebhook(w *models.Webhook, repo *models.Repository, event models.Hoo
var payloader api.Payloader
var err error
- webhook, ok := webhooks[strings.TrimSpace(w.Type)] // NOTICE: w.Type maynot be trimmed before store into database
+ webhook, ok := webhooks[w.Type]
if ok {
payloader, err = webhook.payloadCreator(p, event, w.Meta)
if err != nil {