diff options
author | Dmitriy Zaporozhets <dmitriy.zaporozhets@gmail.com> | 2015-04-23 15:33:01 +0300 |
---|---|---|
committer | Dmitriy Zaporozhets <dmitriy.zaporozhets@gmail.com> | 2015-04-23 15:33:01 +0300 |
commit | 285ae60c15c913aa6145554ecbddf9b966ebd0e7 (patch) | |
tree | 253a50de841b90483569209ce0596d5b20e5f96d /lib/gitlab/reference_extractor.rb | |
parent | 67996c1e03e93b54a5925169fcc973814e82c61c (diff) | |
parent | 51ad59e0d880de4633d18af583be015af229b97d (diff) |
Merge branch 'issue-body-code-mentions' into 'master'
Fix bug causing at-username inside code blocks to sometimes be picked up as a user mention.
Addresses private issue https://dev.gitlab.org/gitlab/gitlabhq/issues/2254.
See merge request !553
Diffstat (limited to 'lib/gitlab/reference_extractor.rb')
-rw-r--r-- | lib/gitlab/reference_extractor.rb | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/lib/gitlab/reference_extractor.rb b/lib/gitlab/reference_extractor.rb index 34aae384355..949dd5d26b1 100644 --- a/lib/gitlab/reference_extractor.rb +++ b/lib/gitlab/reference_extractor.rb @@ -16,8 +16,8 @@ module Gitlab text = text.dup # Remove preformatted/code blocks so that references are not included - text.gsub!(%r{<pre>.*?</pre>|<code>.*?</code>}m) { |match| '' } - text.gsub!(%r{^```.*?^```}m) { |match| '' } + text.gsub!(/^```.*?^```/m, '') + text.gsub!(/[^`]`[^`]*?`[^`]/, '') @references = Hash.new { |hash, type| hash[type] = [] } parse_references(text) |