File tree 1 file changed +2
-10
lines changed
1 file changed +2
-10
lines changed Original file line number Diff line number Diff line change 9
9
"regexp"
10
10
"sync"
11
11
12
- "code.gitea.io/gitea/modules/log"
13
12
"code.gitea.io/gitea/modules/setting"
14
13
15
14
"github.com/microcosm-cc/bluemonday"
@@ -28,7 +27,6 @@ var sanitizer = &Sanitizer{}
28
27
// Multiple calls to this function will only create one instance of Sanitizer during
29
28
// entire application lifecycle.
30
29
func NewSanitizer () {
31
- log .Trace ("Markdown: sanitizer initialization requested" )
32
30
sanitizer .init .Do (func () {
33
31
sanitizer .policy = bluemonday .UGCPolicy ()
34
32
// We only want to allow HighlightJS specific classes for code blocks
@@ -40,16 +38,12 @@ func NewSanitizer() {
40
38
41
39
// Custom URL-Schemes
42
40
sanitizer .policy .AllowURLSchemes (setting .Markdown .CustomURLSchemes ... )
43
-
44
- log .Trace ("Markdown: sanitizer initialized" )
45
41
})
46
42
}
47
43
48
44
// Sanitize takes a string that contains a HTML fragment or document and applies policy whitelist.
49
45
func Sanitize (s string ) string {
50
- if sanitizer .policy == nil {
51
- NewSanitizer ()
52
- }
46
+ NewSanitizer ()
53
47
return sanitizer .policy .Sanitize (s )
54
48
}
55
49
@@ -59,8 +53,6 @@ func SanitizeBytes(b []byte) []byte {
59
53
// nothing to sanitize
60
54
return b
61
55
}
62
- if sanitizer .policy == nil {
63
- NewSanitizer ()
64
- }
56
+ NewSanitizer ()
65
57
return sanitizer .policy .SanitizeBytes (b )
66
58
}
You can’t perform that action at this time.
0 commit comments