Escape text passed to gfm by link_to_gfm

This commit is contained in:
Robert Speicher 2012-09-19 19:42:26 -04:00
parent 01974185a1
commit 496f88afe1
3 changed files with 12 additions and 5 deletions

View file

@ -12,8 +12,8 @@ module GitlabMarkdownHelper
# "<a>outer text </a><a>gfm ref</a><a> more outer text</a>").
def link_to_gfm(body, url, html_options = {})
return "" if body.blank?
gfm_body = gfm(body, html_options)
gfm_body = gfm(escape_once(body), html_options)
gfm_body.gsub!(%r{<a.*?>.*?</a>}m) do |match|
"</a>#{match}#{link_to("", url, html_options)[0..-5]}" # "</a>".length +1