aboutsummaryrefslogtreecommitdiffstats
path: root/services/webhook/slack.go
diff options
context:
space:
mode:
Diffstat (limited to 'services/webhook/slack.go')
-rw-r--r--services/webhook/slack.go5
1 files changed, 4 insertions, 1 deletions
diff --git a/services/webhook/slack.go b/services/webhook/slack.go
index aaecad6c67..f5c857f2a9 100644
--- a/services/webhook/slack.go
+++ b/services/webhook/slack.go
@@ -5,7 +5,6 @@
package webhook
import (
- "encoding/json"
"errors"
"fmt"
"strings"
@@ -15,6 +14,7 @@ import (
"code.gitea.io/gitea/modules/log"
"code.gitea.io/gitea/modules/setting"
api "code.gitea.io/gitea/modules/structs"
+ jsoniter "github.com/json-iterator/go"
)
// SlackMeta contains the slack metadata
@@ -28,6 +28,7 @@ type SlackMeta struct {
// GetSlackHook returns slack metadata
func GetSlackHook(w *models.Webhook) *SlackMeta {
s := &SlackMeta{}
+ json := jsoniter.ConfigCompatibleWithStandardLibrary
if err := json.Unmarshal([]byte(w.Meta), s); err != nil {
log.Error("webhook.GetSlackHook(%d): %v", w.ID, err)
}
@@ -60,6 +61,7 @@ func (s *SlackPayload) SetSecret(_ string) {}
// JSONPayload Marshals the SlackPayload to json
func (s *SlackPayload) JSONPayload() ([]byte, error) {
+ json := jsoniter.ConfigCompatibleWithStandardLibrary
data, err := json.MarshalIndent(s, "", " ")
if err != nil {
return []byte{}, err
@@ -320,6 +322,7 @@ func GetSlackPayload(p api.Payloader, event models.HookEventType, meta string) (
s := new(SlackPayload)
slack := &SlackMeta{}
+ json := jsoniter.ConfigCompatibleWithStandardLibrary
if err := json.Unmarshal([]byte(meta), &slack); err != nil {
return s, errors.New("GetSlackPayload meta json:" + err.Error())
}