Skip to content

Commit 8be348d

Browse files
committed
Resolve conflict
1 parent 0be76da commit 8be348d

File tree

8 files changed

+13
-22
lines changed

8 files changed

+13
-22
lines changed

models/helper.go

+1-2
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ package models
77
import (
88
"encoding/binary"
99

10-
jsoniter "github.com/json-iterator/go"
10+
"code.gitea.io/gitea/modules/json"
1111
)
1212

1313
func keysInt64(m map[int64]struct{}) []int64 {
@@ -37,7 +37,6 @@ func valuesUser(m map[int64]*User) []*User {
3737
// JSONUnmarshalHandleDoubleEncode - due to a bug in xorm (see https://gitea.com/xorm/xorm/pulls/1957) - it's
3838
// possible that a Blob may be double encoded or gain an unwanted prefix of 0xff 0xfe.
3939
func JSONUnmarshalHandleDoubleEncode(bs []byte, v interface{}) error {
40-
json := jsoniter.ConfigCompatibleWithStandardLibrary
4140
err := json.Unmarshal(bs, v)
4241
if err != nil {
4342
ok := true

models/migrations/v189.go

+3-3
Original file line numberDiff line numberDiff line change
@@ -8,13 +8,13 @@ import (
88
"encoding/binary"
99
"fmt"
1010

11-
jsoniter "github.com/json-iterator/go"
11+
"code.gitea.io/gitea/modules/json"
12+
1213
"xorm.io/xorm"
1314
)
1415

1516
func unwrapLDAPSourceCfg(x *xorm.Engine) error {
1617
jsonUnmarshalHandleDoubleEncode := func(bs []byte, v interface{}) error {
17-
json := jsoniter.ConfigCompatibleWithStandardLibrary
1818
err := json.Unmarshal(bs, v)
1919
if err != nil {
2020
ok := true
@@ -84,7 +84,7 @@ func unwrapLDAPSourceCfg(x *xorm.Engine) error {
8484
return fmt.Errorf("failed to unmarshal %s: %w", string(source.Cfg), err)
8585
}
8686
if wrapped.Source != nil && len(wrapped.Source) > 0 {
87-
bs, err := jsoniter.Marshal(wrapped.Source)
87+
bs, err := json.Marshal(wrapped.Source)
8888
if err != nil {
8989
return err
9090
}

models/migrations/v189_test.go

+4-3
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,8 @@ package migrations
77
import (
88
"testing"
99

10-
jsoniter "github.com/json-iterator/go"
10+
"code.gitea.io/gitea/modules/json"
11+
1112
"github.com/stretchr/testify/assert"
1213
)
1314

@@ -65,12 +66,12 @@ func Test_unwrapLDAPSourceCfg(t *testing.T) {
6566
converted := map[string]interface{}{}
6667
expected := map[string]interface{}{}
6768

68-
if err := jsoniter.Unmarshal([]byte(source.Cfg), &converted); err != nil {
69+
if err := json.Unmarshal([]byte(source.Cfg), &converted); err != nil {
6970
assert.NoError(t, err)
7071
return
7172
}
7273

73-
if err := jsoniter.Unmarshal([]byte(source.Expected), &expected); err != nil {
74+
if err := json.Unmarshal([]byte(source.Expected), &expected); err != nil {
7475
assert.NoError(t, err)
7576
return
7677
}

services/auth/source/ldap/source.go

+1-3
Original file line numberDiff line numberDiff line change
@@ -8,10 +8,9 @@ import (
88
"strings"
99

1010
"code.gitea.io/gitea/models"
11+
"code.gitea.io/gitea/modules/json"
1112
"code.gitea.io/gitea/modules/secret"
1213
"code.gitea.io/gitea/modules/setting"
13-
14-
jsoniter "github.com/json-iterator/go"
1514
)
1615

1716
// .____ ________ _____ __________
@@ -79,7 +78,6 @@ func (source *Source) ToDB() ([]byte, error) {
7978
return nil, err
8079
}
8180
source.BindPassword = ""
82-
json := jsoniter.ConfigCompatibleWithStandardLibrary
8381
return json.Marshal(source)
8482
}
8583

services/auth/source/oauth2/source.go

+1-3
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,7 @@ package oauth2
66

77
import (
88
"code.gitea.io/gitea/models"
9-
10-
jsoniter "github.com/json-iterator/go"
9+
"code.gitea.io/gitea/modules/json"
1110
)
1211

1312
// ________ _____ __ .__ ________
@@ -37,7 +36,6 @@ func (source *Source) FromDB(bs []byte) error {
3736

3837
// ToDB exports an SMTPConfig to a serialized format.
3938
func (source *Source) ToDB() ([]byte, error) {
40-
json := jsoniter.ConfigCompatibleWithStandardLibrary
4139
return json.Marshal(source)
4240
}
4341

services/auth/source/pam/source.go

+1-3
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,7 @@ package pam
66

77
import (
88
"code.gitea.io/gitea/models"
9-
10-
jsoniter "github.com/json-iterator/go"
9+
"code.gitea.io/gitea/modules/json"
1110
)
1211

1312
// __________ _____ _____
@@ -33,7 +32,6 @@ func (source *Source) FromDB(bs []byte) error {
3332

3433
// ToDB exports a PAMConfig to a serialized format.
3534
func (source *Source) ToDB() ([]byte, error) {
36-
json := jsoniter.ConfigCompatibleWithStandardLibrary
3735
return json.Marshal(source)
3836
}
3937

services/auth/source/smtp/source.go

+1-3
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,7 @@ package smtp
66

77
import (
88
"code.gitea.io/gitea/models"
9-
10-
jsoniter "github.com/json-iterator/go"
9+
"code.gitea.io/gitea/modules/json"
1110
)
1211

1312
// _________ __________________________
@@ -37,7 +36,6 @@ func (source *Source) FromDB(bs []byte) error {
3736

3837
// ToDB exports an SMTPConfig to a serialized format.
3938
func (source *Source) ToDB() ([]byte, error) {
40-
json := jsoniter.ConfigCompatibleWithStandardLibrary
4139
return json.Marshal(source)
4240
}
4341

services/auth/source/sspi/source.go

+1-2
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ package sspi
66

77
import (
88
"code.gitea.io/gitea/models"
9-
jsoniter "github.com/json-iterator/go"
9+
"code.gitea.io/gitea/modules/json"
1010
)
1111

1212
// _________ ___________________.___
@@ -32,7 +32,6 @@ func (cfg *Source) FromDB(bs []byte) error {
3232

3333
// ToDB exports an SSPIConfig to a serialized format.
3434
func (cfg *Source) ToDB() ([]byte, error) {
35-
json := jsoniter.ConfigCompatibleWithStandardLibrary
3635
return json.Marshal(cfg)
3736
}
3837

0 commit comments

Comments
 (0)