Commit 8be348d 1 parent 0be76da commit 8be348d Copy full SHA for 8be348d
File tree 8 files changed +13
-22
lines changed
8 files changed +13
-22
lines changed Original file line number Diff line number Diff line change @@ -7,7 +7,7 @@ package models
7
7
import (
8
8
"encoding/binary"
9
9
10
- jsoniter "github.com/json-iterator/go "
10
+ "code.gitea.io/gitea/modules/json "
11
11
)
12
12
13
13
func keysInt64 (m map [int64 ]struct {}) []int64 {
@@ -37,7 +37,6 @@ func valuesUser(m map[int64]*User) []*User {
37
37
// JSONUnmarshalHandleDoubleEncode - due to a bug in xorm (see https://gitea.com/xorm/xorm/pulls/1957) - it's
38
38
// possible that a Blob may be double encoded or gain an unwanted prefix of 0xff 0xfe.
39
39
func JSONUnmarshalHandleDoubleEncode (bs []byte , v interface {}) error {
40
- json := jsoniter .ConfigCompatibleWithStandardLibrary
41
40
err := json .Unmarshal (bs , v )
42
41
if err != nil {
43
42
ok := true
Original file line number Diff line number Diff line change @@ -8,13 +8,13 @@ import (
8
8
"encoding/binary"
9
9
"fmt"
10
10
11
- jsoniter "github.com/json-iterator/go"
11
+ "code.gitea.io/gitea/modules/json"
12
+
12
13
"xorm.io/xorm"
13
14
)
14
15
15
16
func unwrapLDAPSourceCfg (x * xorm.Engine ) error {
16
17
jsonUnmarshalHandleDoubleEncode := func (bs []byte , v interface {}) error {
17
- json := jsoniter .ConfigCompatibleWithStandardLibrary
18
18
err := json .Unmarshal (bs , v )
19
19
if err != nil {
20
20
ok := true
@@ -84,7 +84,7 @@ func unwrapLDAPSourceCfg(x *xorm.Engine) error {
84
84
return fmt .Errorf ("failed to unmarshal %s: %w" , string (source .Cfg ), err )
85
85
}
86
86
if wrapped .Source != nil && len (wrapped .Source ) > 0 {
87
- bs , err := jsoniter .Marshal (wrapped .Source )
87
+ bs , err := json .Marshal (wrapped .Source )
88
88
if err != nil {
89
89
return err
90
90
}
Original file line number Diff line number Diff line change @@ -7,7 +7,8 @@ package migrations
7
7
import (
8
8
"testing"
9
9
10
- jsoniter "github.com/json-iterator/go"
10
+ "code.gitea.io/gitea/modules/json"
11
+
11
12
"github.com/stretchr/testify/assert"
12
13
)
13
14
@@ -65,12 +66,12 @@ func Test_unwrapLDAPSourceCfg(t *testing.T) {
65
66
converted := map [string ]interface {}{}
66
67
expected := map [string ]interface {}{}
67
68
68
- if err := jsoniter .Unmarshal ([]byte (source .Cfg ), & converted ); err != nil {
69
+ if err := json .Unmarshal ([]byte (source .Cfg ), & converted ); err != nil {
69
70
assert .NoError (t , err )
70
71
return
71
72
}
72
73
73
- if err := jsoniter .Unmarshal ([]byte (source .Expected ), & expected ); err != nil {
74
+ if err := json .Unmarshal ([]byte (source .Expected ), & expected ); err != nil {
74
75
assert .NoError (t , err )
75
76
return
76
77
}
Original file line number Diff line number Diff line change @@ -8,10 +8,9 @@ import (
8
8
"strings"
9
9
10
10
"code.gitea.io/gitea/models"
11
+ "code.gitea.io/gitea/modules/json"
11
12
"code.gitea.io/gitea/modules/secret"
12
13
"code.gitea.io/gitea/modules/setting"
13
-
14
- jsoniter "github.com/json-iterator/go"
15
14
)
16
15
17
16
// .____ ________ _____ __________
@@ -79,7 +78,6 @@ func (source *Source) ToDB() ([]byte, error) {
79
78
return nil , err
80
79
}
81
80
source .BindPassword = ""
82
- json := jsoniter .ConfigCompatibleWithStandardLibrary
83
81
return json .Marshal (source )
84
82
}
85
83
Original file line number Diff line number Diff line change @@ -6,8 +6,7 @@ package oauth2
6
6
7
7
import (
8
8
"code.gitea.io/gitea/models"
9
-
10
- jsoniter "github.com/json-iterator/go"
9
+ "code.gitea.io/gitea/modules/json"
11
10
)
12
11
13
12
// ________ _____ __ .__ ________
@@ -37,7 +36,6 @@ func (source *Source) FromDB(bs []byte) error {
37
36
38
37
// ToDB exports an SMTPConfig to a serialized format.
39
38
func (source * Source ) ToDB () ([]byte , error ) {
40
- json := jsoniter .ConfigCompatibleWithStandardLibrary
41
39
return json .Marshal (source )
42
40
}
43
41
Original file line number Diff line number Diff line change @@ -6,8 +6,7 @@ package pam
6
6
7
7
import (
8
8
"code.gitea.io/gitea/models"
9
-
10
- jsoniter "github.com/json-iterator/go"
9
+ "code.gitea.io/gitea/modules/json"
11
10
)
12
11
13
12
// __________ _____ _____
@@ -33,7 +32,6 @@ func (source *Source) FromDB(bs []byte) error {
33
32
34
33
// ToDB exports a PAMConfig to a serialized format.
35
34
func (source * Source ) ToDB () ([]byte , error ) {
36
- json := jsoniter .ConfigCompatibleWithStandardLibrary
37
35
return json .Marshal (source )
38
36
}
39
37
Original file line number Diff line number Diff line change @@ -6,8 +6,7 @@ package smtp
6
6
7
7
import (
8
8
"code.gitea.io/gitea/models"
9
-
10
- jsoniter "github.com/json-iterator/go"
9
+ "code.gitea.io/gitea/modules/json"
11
10
)
12
11
13
12
// _________ __________________________
@@ -37,7 +36,6 @@ func (source *Source) FromDB(bs []byte) error {
37
36
38
37
// ToDB exports an SMTPConfig to a serialized format.
39
38
func (source * Source ) ToDB () ([]byte , error ) {
40
- json := jsoniter .ConfigCompatibleWithStandardLibrary
41
39
return json .Marshal (source )
42
40
}
43
41
Original file line number Diff line number Diff line change @@ -6,7 +6,7 @@ package sspi
6
6
7
7
import (
8
8
"code.gitea.io/gitea/models"
9
- jsoniter "github.com/json-iterator/go "
9
+ "code.gitea.io/gitea/modules/json "
10
10
)
11
11
12
12
// _________ ___________________.___
@@ -32,7 +32,6 @@ func (cfg *Source) FromDB(bs []byte) error {
32
32
33
33
// ToDB exports an SSPIConfig to a serialized format.
34
34
func (cfg * Source ) ToDB () ([]byte , error ) {
35
- json := jsoniter .ConfigCompatibleWithStandardLibrary
36
35
return json .Marshal (cfg )
37
36
}
38
37
You can’t perform that action at this time.
0 commit comments