aboutsummaryrefslogtreecommitdiff
path: root/pkg
diff options
context:
space:
mode:
Diffstat (limited to 'pkg')
-rw-r--r--pkg/markup/markup.go6
-rw-r--r--pkg/markup/sanitizer.go3
2 files changed, 9 insertions, 0 deletions
diff --git a/pkg/markup/markup.go b/pkg/markup/markup.go
index 2d571489..ee91b7b1 100644
--- a/pkg/markup/markup.go
+++ b/pkg/markup/markup.go
@@ -190,6 +190,12 @@ func wrapImgWithLink(urlPrefix string, buf *bytes.Buffer, token html.Token) {
return
}
+ // Skip in case the "src" is data url
+ if strings.HasPrefix(src, "data:") {
+ buf.WriteString(token.String())
+ return
+ }
+
// Prepend repository base URL for internal links
needPrepend := !isLink([]byte(src))
if needPrepend {
diff --git a/pkg/markup/sanitizer.go b/pkg/markup/sanitizer.go
index 371f5b3f..3f1e41b7 100644
--- a/pkg/markup/sanitizer.go
+++ b/pkg/markup/sanitizer.go
@@ -36,6 +36,9 @@ func NewSanitizer() {
sanitizer.policy.AllowAttrs("type").Matching(regexp.MustCompile(`^checkbox$`)).OnElements("input")
sanitizer.policy.AllowAttrs("checked", "disabled").OnElements("input")
+ // Data URLs
+ sanitizer.policy.AllowURLSchemes("data")
+
// Custom URL-Schemes
sanitizer.policy.AllowURLSchemes(setting.Markdown.CustomURLSchemes...)
})