aboutsummaryrefslogtreecommitdiffstats
path: root/modules
diff options
context:
space:
mode:
authorLunny Xiao <xiaolunwen@gmail.com>2017-04-19 19:16:36 +0800
committerGitHub <noreply@github.com>2017-04-19 19:16:36 +0800
commita2d365c81fc4eb35ac598bcef696eb1b775b8a9b (patch)
tree159e9695e6f0ba5b2afc3519e18ede1156bc05b2 /modules
parentf995bcc87a9e693883292247ec985df7541d06bf (diff)
downloadgitea-a2d365c81fc4eb35ac598bcef696eb1b775b8a9b.tar.gz
gitea-a2d365c81fc4eb35ac598bcef696eb1b775b8a9b.zip
fix #1501 ssh hangs caused by #1461 (#1513)
Diffstat (limited to 'modules')
-rw-r--r--modules/markdown/sanitizer.go12
1 files changed, 2 insertions, 10 deletions
diff --git a/modules/markdown/sanitizer.go b/modules/markdown/sanitizer.go
index 14e8fc1b22..cc00c9a1a3 100644
--- a/modules/markdown/sanitizer.go
+++ b/modules/markdown/sanitizer.go
@@ -9,7 +9,6 @@ import (
"regexp"
"sync"
- "code.gitea.io/gitea/modules/log"
"code.gitea.io/gitea/modules/setting"
"github.com/microcosm-cc/bluemonday"
@@ -28,7 +27,6 @@ var sanitizer = &Sanitizer{}
// Multiple calls to this function will only create one instance of Sanitizer during
// entire application lifecycle.
func NewSanitizer() {
- log.Trace("Markdown: sanitizer initialization requested")
sanitizer.init.Do(func() {
sanitizer.policy = bluemonday.UGCPolicy()
// We only want to allow HighlightJS specific classes for code blocks
@@ -40,16 +38,12 @@ func NewSanitizer() {
// Custom URL-Schemes
sanitizer.policy.AllowURLSchemes(setting.Markdown.CustomURLSchemes...)
-
- log.Trace("Markdown: sanitizer initialized")
})
}
// Sanitize takes a string that contains a HTML fragment or document and applies policy whitelist.
func Sanitize(s string) string {
- if sanitizer.policy == nil {
- NewSanitizer()
- }
+ NewSanitizer()
return sanitizer.policy.Sanitize(s)
}
@@ -59,8 +53,6 @@ func SanitizeBytes(b []byte) []byte {
// nothing to sanitize
return b
}
- if sanitizer.policy == nil {
- NewSanitizer()
- }
+ NewSanitizer()
return sanitizer.policy.SanitizeBytes(b)
}