diff options
author | Nikita <6773262+Nikeron@users.noreply.github.com> | 2018-12-11 08:53:08 +0400 |
---|---|---|
committer | 无闻 <u@gogs.io> | 2018-12-10 23:53:08 -0500 |
commit | 9079fb6a0df75e351800c434cdc226fd8bc47e71 (patch) | |
tree | 131bcbd256f9a75cac56eafd0917d685b7d461ac /pkg/markup/markup.go | |
parent | db3f0048d80f4f7aaa903d367ace67b8cd0389dc (diff) |
pkg/markup: support data URL of base64 encoded images (#5391)
Diffstat (limited to 'pkg/markup/markup.go')
-rw-r--r-- | pkg/markup/markup.go | 6 |
1 files changed, 6 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 { |