Commit f72dc7f7 authored by Dmitriy Zaporozhets's avatar Dmitriy Zaporozhets

dont escape images inside links for gfm. Fixes #2701

parent 1c931fb8
......@@ -13,7 +13,13 @@ module GitlabMarkdownHelper
def link_to_gfm(body, url, html_options = {})
return "" if body.blank?
gfm_body = gfm(escape_once(body), html_options)
escaped_body = if body =~ /^\<img/
body
else
escape_once(body)
end
gfm_body = gfm(escaped_body, html_options)
gfm_body.gsub!(%r{<a.*?>.*?</a>}m) do |match|
"</a>#{match}#{link_to("", url, html_options)[0..-5]}" # "</a>".length +1
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment