diff options
Diffstat (limited to 'routers/api/v1/utils/hook.go')
-rw-r--r-- | routers/api/v1/utils/hook.go | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/routers/api/v1/utils/hook.go b/routers/api/v1/utils/hook.go index b0ce40b9fb..c7af40dcf0 100644 --- a/routers/api/v1/utils/hook.go +++ b/routers/api/v1/utils/hook.go @@ -5,7 +5,6 @@ package utils import ( - "encoding/json" "fmt" "net/http" "strings" @@ -17,6 +16,7 @@ import ( "code.gitea.io/gitea/modules/util" "code.gitea.io/gitea/routers/utils" "code.gitea.io/gitea/services/webhook" + jsoniter "github.com/json-iterator/go" ) // GetOrgHook get an organization's webhook. If there is an error, write to @@ -147,6 +147,7 @@ func addHook(ctx *context.APIContext, form *api.CreateHookOption, orgID, repoID return nil, false } + json := jsoniter.ConfigCompatibleWithStandardLibrary meta, err := json.Marshal(&webhook.SlackMeta{ Channel: strings.TrimSpace(channel), Username: form.Config["username"], @@ -221,6 +222,7 @@ func editHook(ctx *context.APIContext, form *api.EditHookOption, w *models.Webho if w.Type == models.SLACK { if channel, ok := form.Config["channel"]; ok { + json := jsoniter.ConfigCompatibleWithStandardLibrary meta, err := json.Marshal(&webhook.SlackMeta{ Channel: channel, Username: form.Config["username"], |