From 36cc86aeb0cd9e7a75126ce0b2684563c82bddae Mon Sep 17 00:00:00 2001 From: aichy126 <16996097+aichy126@users.noreply.github.com> Date: Tue, 21 Feb 2023 11:29:54 +0800 Subject: [PATCH 1/2] update validator --- docs/docs.go | 3 +++ docs/swagger.json | 3 +++ docs/swagger.yaml | 2 ++ internal/base/validator/validator.go | 3 ++- 4 files changed, 10 insertions(+), 1 deletion(-) diff --git a/docs/docs.go b/docs/docs.go index 1dedea4d..d6741817 100644 --- a/docs/docs.go +++ b/docs/docs.go @@ -7173,6 +7173,9 @@ const docTemplate = `{ }, "theme": { "$ref": "#/definitions/schema.SiteThemeResp" + }, + "version": { + "type": "string" } } }, diff --git a/docs/swagger.json b/docs/swagger.json index ca8d737d..8433f7c5 100644 --- a/docs/swagger.json +++ b/docs/swagger.json @@ -7161,6 +7161,9 @@ }, "theme": { "$ref": "#/definitions/schema.SiteThemeResp" + }, + "version": { + "type": "string" } } }, diff --git a/docs/swagger.yaml b/docs/swagger.yaml index da69a617..f3663b28 100644 --- a/docs/swagger.yaml +++ b/docs/swagger.yaml @@ -1335,6 +1335,8 @@ definitions: $ref: '#/definitions/schema.SiteSeoReq' theme: $ref: '#/definitions/schema.SiteThemeResp' + version: + type: string type: object schema.SiteInterfaceReq: properties: diff --git a/internal/base/validator/validator.go b/internal/base/validator/validator.go index b0f7fbf7..3ce824a4 100644 --- a/internal/base/validator/validator.go +++ b/internal/base/validator/validator.go @@ -122,7 +122,8 @@ func Sanitizer(fl validator.FieldLevel) (res bool) { switch field.Kind() { case reflect.String: filter := bluemonday.UGCPolicy() - field.SetString(filter.Sanitize(field.String())) + content := strings.Replace(filter.Sanitize(field.String()), "&", "&", -1) + field.SetString(content) return true case reflect.Chan, reflect.Map, reflect.Slice, reflect.Array: return field.Len() > 0 From 6cd741962746a8fc17d08bfda7bba243144d8fab Mon Sep 17 00:00:00 2001 From: LinkinStars Date: Tue, 21 Feb 2023 14:34:22 +0800 Subject: [PATCH 2/2] fix(gomod): remove the require that is not needed --- go.mod | 5 ----- go.sum | 6 +++--- 2 files changed, 3 insertions(+), 8 deletions(-) diff --git a/go.mod b/go.mod index 2a1f59eb..baaa08c5 100644 --- a/go.mod +++ b/go.mod @@ -139,8 +139,3 @@ require ( modernc.org/token v1.0.0 // indirect sigs.k8s.io/yaml v1.3.0 // indirect ) - -// github action runner Sometimes it will time out. -replace gitee.com/travelliu/dm v1.8.11192 => github.com/aichy126/dm v1.8.11192 - -replace modernc.org/z v1.2.19 => github.com/aichy126/modernc.org_z v1.2.19 diff --git a/go.sum b/go.sum index 2a0f93f0..95de6076 100644 --- a/go.sum +++ b/go.sum @@ -38,6 +38,7 @@ cloud.google.com/go/storage v1.14.0/go.mod h1:GrKmX003DSIwi9o29oFT7YDnHYwZoctc3f dmitri.shuralyov.com/gpu/mtl v0.0.0-20190408044501-666a987793e9/go.mod h1:H6x//7gZCb22OMCxBHrMx7a5I7Hp++hsVxbQ4BYO7hU= gitea.com/xorm/sqlfiddle v0.0.0-20180821085327-62ce714f951a h1:lSA0F4e9A2NcQSqGqTOXqu2aRi/XEQxDCBwM8yJtE6s= gitea.com/xorm/sqlfiddle v0.0.0-20180821085327-62ce714f951a/go.mod h1:EXuID2Zs0pAQhH8yz+DNjUbjppKQzKFAn28TMYPB6IU= +gitee.com/travelliu/dm v1.8.11192/go.mod h1:DHTzyhCrM843x9VdKVbZ+GKXGRbKM2sJ4LxihRxShkE= github.com/Azure/go-ansiterm v0.0.0-20170929234023-d6e3b3328b78 h1:w+iIsaOQNcT7OZ575w+acHgRric5iCyQh+xv+KJ4HB8= github.com/Azure/go-ansiterm v0.0.0-20170929234023-d6e3b3328b78/go.mod h1:LmzpDX56iTiv29bbRTIsUNlaFfuhWRQBWjQdVyAevI8= github.com/BurntSushi/toml v0.3.1/go.mod h1:xHWCNGjB5oqiDr8zfno3MHue2Ht5sIBksp03qcyfWMU= @@ -63,9 +64,6 @@ github.com/Shopify/toxiproxy v2.1.4+incompatible/go.mod h1:OXgGpZ6Cli1/URJOF1DMx github.com/VividCortex/gohistogram v1.0.0/go.mod h1:Pf5mBqqDxYaXu3hDrrU+w6nw50o/4+TcAqDqk/vUH7g= github.com/afex/hystrix-go v0.0.0-20180502004556-fa1af6a1f4f5/go.mod h1:SkGFH1ia65gfNATL8TAiHDNxPzPdmEL5uirI2Uyuz6c= github.com/agiledragon/gomonkey/v2 v2.3.1/go.mod h1:ap1AmDzcVOAz1YpeJ3TCzIgstoaWLA6jbbgxfB4w2iY= -github.com/aichy126/dm v1.8.11192/go.mod h1:DHTzyhCrM843x9VdKVbZ+GKXGRbKM2sJ4LxihRxShkE= -github.com/aichy126/modernc.org_z v1.2.19 h1:g4KvQojkFWBJk47OGvKzuudTr5mRF7jORSwobYyc2Sc= -github.com/aichy126/modernc.org_z v1.2.19/go.mod h1:+ZpP0pc4zz97eukOzW3xagV/lS82IpPN9NGG5pNF9vY= github.com/alecthomas/template v0.0.0-20160405071501-a0175ee3bccc/go.mod h1:LOuyumcjzFXgccqObfd/Ljyb9UuFJ6TxHnclSeseNhc= github.com/alecthomas/template v0.0.0-20190718012654-fb15b899a751/go.mod h1:LOuyumcjzFXgccqObfd/Ljyb9UuFJ6TxHnclSeseNhc= github.com/alecthomas/units v0.0.0-20151022065526-2efee857e7cf/go.mod h1:ybxpYRFXyAe+OPACYpWeL0wqObRcbAqCMya13uyzqw0= @@ -1295,6 +1293,8 @@ modernc.org/tcl v1.8.13 h1:V0sTNBw0Re86PvXZxuCub3oO9WrSTqALgrwNZNvLFGw= modernc.org/tcl v1.8.13/go.mod h1:V+q/Ef0IJaNUSECieLU4o+8IScapxnMyFV6i/7uQlAY= modernc.org/token v1.0.0 h1:a0jaWiNMDhDUtqOj09wvjWWAqd3q7WpBulmL9H2egsk= modernc.org/token v1.0.0/go.mod h1:UGzOrNV1mAFSEB63lOFHIpNRUVMvYTc6yu1SMY/XTDM= +modernc.org/z v1.2.19 h1:BGyRFWhDVn5LFS5OcX4Yd/MlpRTOc7hOPTdcIpCiUao= +modernc.org/z v1.2.19/go.mod h1:+ZpP0pc4zz97eukOzW3xagV/lS82IpPN9NGG5pNF9vY= rsc.io/binaryregexp v0.2.0/go.mod h1:qTv7/COck+e2FymRvadv62gMdZztPaShugOCi3I+8D8= rsc.io/quote/v3 v3.1.0/go.mod h1:yEA65RcK8LyAZtP9Kv3t0HmxON59tX3rD+tICJqUlj0= rsc.io/sampler v1.3.0/go.mod h1:T1hPZKmBbMNahiBKFy5HrXp6adAjACjK9JXDnKaTXpA=