diff options
Diffstat (limited to 'services/webhook/matrix.go')
-rw-r--r-- | services/webhook/matrix.go | 6 |
1 files changed, 1 insertions, 5 deletions
diff --git a/services/webhook/matrix.go b/services/webhook/matrix.go index 6fca67ca84..10e0c8fd15 100644 --- a/services/webhook/matrix.go +++ b/services/webhook/matrix.go @@ -15,10 +15,10 @@ import ( "code.gitea.io/gitea/models" "code.gitea.io/gitea/modules/git" + "code.gitea.io/gitea/modules/json" "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" ) const matrixPayloadSizeLimit = 1024 * 64 @@ -39,7 +39,6 @@ var messageTypeText = map[int]string{ // GetMatrixHook returns Matrix metadata func GetMatrixHook(w *models.Webhook) *MatrixMeta { s := &MatrixMeta{} - json := jsoniter.ConfigCompatibleWithStandardLibrary if err := json.Unmarshal([]byte(w.Meta), s); err != nil { log.Error("webhook.GetMatrixHook(%d): %v", w.ID, err) } @@ -78,7 +77,6 @@ type MatrixPayloadSafe struct { // JSONPayload Marshals the MatrixPayloadUnsafe to json func (m *MatrixPayloadUnsafe) JSONPayload() ([]byte, error) { - json := jsoniter.ConfigCompatibleWithStandardLibrary data, err := json.MarshalIndent(m, "", " ") if err != nil { return []byte{}, err @@ -228,7 +226,6 @@ func GetMatrixPayload(p api.Payloader, event models.HookEventType, meta string) s := new(MatrixPayloadUnsafe) matrix := &MatrixMeta{} - json := jsoniter.ConfigCompatibleWithStandardLibrary if err := json.Unmarshal([]byte(meta), &matrix); err != nil { return s, errors.New("GetMatrixPayload meta json:" + err.Error()) } @@ -262,7 +259,6 @@ func getMessageBody(htmlText string) string { // The access_token is removed from t.PayloadContent func getMatrixHookRequest(w *models.Webhook, t *models.HookTask) (*http.Request, error) { payloadunsafe := MatrixPayloadUnsafe{} - json := jsoniter.ConfigCompatibleWithStandardLibrary if err := json.Unmarshal([]byte(t.PayloadContent), &payloadunsafe); err != nil { log.Error("Matrix Hook delivery failed: %v", err) return nil, err |