Commit f72dc7f7798f521d20a71fb465df57f0d66befb5
1 parent
1c931fb8
Exists in
master
and in
4 other branches
dont escape images inside links for gfm. Fixes #2701
Showing
1 changed file
with
7 additions
and
1 deletions
Show diff stats
app/helpers/gitlab_markdown_helper.rb
... | ... | @@ -13,7 +13,13 @@ module GitlabMarkdownHelper |
13 | 13 | def link_to_gfm(body, url, html_options = {}) |
14 | 14 | return "" if body.blank? |
15 | 15 | |
16 | - gfm_body = gfm(escape_once(body), html_options) | |
16 | + escaped_body = if body =~ /^\<img/ | |
17 | + body | |
18 | + else | |
19 | + escape_once(body) | |
20 | + end | |
21 | + | |
22 | + gfm_body = gfm(escaped_body, html_options) | |
17 | 23 | |
18 | 24 | gfm_body.gsub!(%r{<a.*?>.*?</a>}m) do |match| |
19 | 25 | "</a>#{match}#{link_to("", url, html_options)[0..-5]}" # "</a>".length +1 | ... | ... |