File tree Expand file tree Collapse file tree 1 file changed +2
-10
lines changed Expand file tree Collapse file tree 1 file changed +2
-10
lines changed Original file line number Diff line number Diff line change 99 "regexp"
1010 "sync"
1111
12- "code.gitea.io/gitea/modules/log"
1312 "code.gitea.io/gitea/modules/setting"
1413
1514 "github.com/microcosm-cc/bluemonday"
@@ -28,7 +27,6 @@ var sanitizer = &Sanitizer{}
2827// Multiple calls to this function will only create one instance of Sanitizer during
2928// entire application lifecycle.
3029func NewSanitizer () {
31- log .Trace ("Markdown: sanitizer initialization requested" )
3230 sanitizer .init .Do (func () {
3331 sanitizer .policy = bluemonday .UGCPolicy ()
3432 // We only want to allow HighlightJS specific classes for code blocks
@@ -40,16 +38,12 @@ func NewSanitizer() {
4038
4139 // Custom URL-Schemes
4240 sanitizer .policy .AllowURLSchemes (setting .Markdown .CustomURLSchemes ... )
43-
44- log .Trace ("Markdown: sanitizer initialized" )
4541 })
4642}
4743
4844// Sanitize takes a string that contains a HTML fragment or document and applies policy whitelist.
4945func Sanitize (s string ) string {
50- if sanitizer .policy == nil {
51- NewSanitizer ()
52- }
46+ NewSanitizer ()
5347 return sanitizer .policy .Sanitize (s )
5448}
5549
@@ -59,8 +53,6 @@ func SanitizeBytes(b []byte) []byte {
5953 // nothing to sanitize
6054 return b
6155 }
62- if sanitizer .policy == nil {
63- NewSanitizer ()
64- }
56+ NewSanitizer ()
6557 return sanitizer .policy .SanitizeBytes (b )
6658}
You can’t perform that action at this time.
0 commit comments