summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorReuben Pereira <reuben453@gmail.com>2018-07-04 21:41:46 +0530
committerReuben Pereira <reuben453@gmail.com>2018-07-04 21:41:46 +0530
commit77c53f61262e01197c89f5c59f627c38df83be53 (patch)
treea21b9e70433becc97c5be1ad463fb0af65e35ce2
parentd6f4810ea154d2f2303591ac37d616c8249fca9d (diff)
downloadgitlab-ce-77c53f61262e01197c89f5c59f627c38df83be53.tar.gz
Remove the restriction preventing project references with text adjacent to the > character
-rw-r--r--app/models/project.rb2
-rw-r--r--spec/lib/banzai/filter/project_reference_filter_spec.rb6
2 files changed, 3 insertions, 5 deletions
diff --git a/app/models/project.rb b/app/models/project.rb
index 79beec77843..9dfa9a144fd 100644
--- a/app/models/project.rb
+++ b/app/models/project.rb
@@ -465,14 +465,12 @@ class Project < ActiveRecord::Base
end
# Pattern used to extract `namespace/project>` project references from text.
- # (?!\w) matches any non-word character.
# '>' or its escaped form ('&gt;') are checked for because '>' is sometimes escaped
# when the reference comes from an external source.
def markdown_reference_pattern
%r{
#{reference_pattern}
(#{reference_postfix}|#{reference_postfix_escaped})
- (?!\w)
}x
end
diff --git a/spec/lib/banzai/filter/project_reference_filter_spec.rb b/spec/lib/banzai/filter/project_reference_filter_spec.rb
index 559293d5ac3..20f809e010e 100644
--- a/spec/lib/banzai/filter/project_reference_filter_spec.rb
+++ b/spec/lib/banzai/filter/project_reference_filter_spec.rb
@@ -24,9 +24,9 @@ describe Banzai::Filter::ProjectReferenceFilter do
expect(reference_filter(act).to_html).to eq(CGI.escapeHTML(exp))
end
- it 'ignores references with text after the > sign' do
- exp = act = "Hey #{reference}foo"
- expect(reference_filter(act).to_html).to eq CGI.escapeHTML(exp)
+ it 'allows references with text after the > character' do
+ doc = reference_filter("Hey #{reference}foo")
+ expect(doc.css('a').first.attr('href')).to eq urls.project_url(subject)
end
%w(pre code a style).each do |elem|