Welcome to mirror list, hosted at ThFree Co, Russian Federation.

gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
path: root/app
diff options
context:
space:
mode:
authorDmitriy Zaporozhets <dmitriy.zaporozhets@gmail.com>2013-01-29 13:00:56 +0400
committerDmitriy Zaporozhets <dmitriy.zaporozhets@gmail.com>2013-01-29 13:00:56 +0400
commitf72dc7f7798f521d20a71fb465df57f0d66befb5 (patch)
tree8664653f0cc6f9aec71d9d02f578cdf863893785 /app
parent1c931fb81477397929a31a6b95c5d65b6d582182 (diff)
dont escape images inside links for gfm. Fixes #2701
Diffstat (limited to 'app')
-rw-r--r--app/helpers/gitlab_markdown_helper.rb8
1 files changed, 7 insertions, 1 deletions
diff --git a/app/helpers/gitlab_markdown_helper.rb b/app/helpers/gitlab_markdown_helper.rb
index 111982e9147..1a3d34eb886 100644
--- a/app/helpers/gitlab_markdown_helper.rb
+++ b/app/helpers/gitlab_markdown_helper.rb
@@ -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