update validator

This commit is contained in:
aichy126
2023-02-21 11:29:54 +08:00
parent a66f104d02
commit 36cc86aeb0
4 changed files with 10 additions and 1 deletions
+3
View File
@@ -7173,6 +7173,9 @@ const docTemplate = `{
},
"theme": {
"$ref": "#/definitions/schema.SiteThemeResp"
},
"version": {
"type": "string"
}
}
},
+3
View File
@@ -7161,6 +7161,9 @@
},
"theme": {
"$ref": "#/definitions/schema.SiteThemeResp"
},
"version": {
"type": "string"
}
}
},
+2
View File
@@ -1335,6 +1335,8 @@ definitions:
$ref: '#/definitions/schema.SiteSeoReq'
theme:
$ref: '#/definitions/schema.SiteThemeResp'
version:
type: string
type: object
schema.SiteInterfaceReq:
properties:
+2 -1
View File
@@ -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