summaryrefslogtreecommitdiffstats
path: root/modules/markup/sanitizer.go
diff options
context:
space:
mode:
Diffstat (limited to 'modules/markup/sanitizer.go')
-rw-r--r--modules/markup/sanitizer.go7
1 files changed, 6 insertions, 1 deletions
diff --git a/modules/markup/sanitizer.go b/modules/markup/sanitizer.go
index 600ccbf3c6..a0c9ee171f 100644
--- a/modules/markup/sanitizer.go
+++ b/modules/markup/sanitizer.go
@@ -22,7 +22,10 @@ type Sanitizer struct {
init sync.Once
}
-var sanitizer = &Sanitizer{}
+var (
+ sanitizer = &Sanitizer{}
+ allowAllRegex = regexp.MustCompile(".+")
+)
// NewSanitizer initializes sanitizer with allowed attributes based on settings.
// Multiple calls to this function will only create one instance of Sanitizer during
@@ -74,6 +77,8 @@ func createDefaultPolicy() *bluemonday.Policy {
// Custom URL-Schemes
if len(setting.Markdown.CustomURLSchemes) > 0 {
policy.AllowURLSchemes(setting.Markdown.CustomURLSchemes...)
+ } else {
+ policy.AllowURLSchemesMatching(allowAllRegex)
}
// Allow classes for anchors