diff options
Diffstat (limited to 'modules/markup/sanitizer.go')
-rw-r--r-- | modules/markup/sanitizer.go | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/modules/markup/sanitizer.go b/modules/markup/sanitizer.go index f7789a9e56..d135d41966 100644 --- a/modules/markup/sanitizer.go +++ b/modules/markup/sanitizer.go @@ -6,6 +6,8 @@ package markup import ( + "bytes" + "io" "regexp" "sync" @@ -67,6 +69,12 @@ func Sanitize(s string) string { return sanitizer.policy.Sanitize(s) } +// SanitizeReader sanitizes a Reader +func SanitizeReader(r io.Reader) *bytes.Buffer { + NewSanitizer() + return sanitizer.policy.SanitizeReader(r) +} + // SanitizeBytes takes a []byte slice that contains a HTML fragment or document and applies policy whitelist. func SanitizeBytes(b []byte) []byte { if len(b) == 0 { |