🎨 updated error handling logic

This commit is contained in:
landaiqing
2024-11-18 01:12:50 +08:00
parent 78a162a19a
commit 35d2da35b2
48 changed files with 395 additions and 170 deletions

View File

@@ -0,0 +1,11 @@
package utils
import "github.com/microcosm-cc/bluemonday"
// XssFilter Xss 过滤器
func XssFilter(str string) string {
p := bluemonday.NewPolicy()
p.AllowElements("br", "img")
p.AllowAttrs("style", "src", "alt", "width", "height", "loading").OnElements("img")
return p.Sanitize(str)
}