Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
G
gitlab-ce
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Boxiang Sun
gitlab-ce
Commits
77c53f61
Commit
77c53f61
authored
Jul 04, 2018
by
Reuben Pereira
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Remove the restriction preventing project references with text adjacent to the > character
parent
d6f4810e
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
3 additions
and
5 deletions
+3
-5
app/models/project.rb
app/models/project.rb
+0
-2
spec/lib/banzai/filter/project_reference_filter_spec.rb
spec/lib/banzai/filter/project_reference_filter_spec.rb
+3
-3
No files found.
app/models/project.rb
View file @
77c53f61
...
@@ -465,14 +465,12 @@ class Project < ActiveRecord::Base
...
@@ -465,14 +465,12 @@ class Project < ActiveRecord::Base
end
end
# Pattern used to extract `namespace/project>` project references from text.
# Pattern used to extract `namespace/project>` project references from text.
# (?!\w) matches any non-word character.
# '>' or its escaped form ('>') are checked for because '>' is sometimes escaped
# '>' or its escaped form ('>') are checked for because '>' is sometimes escaped
# when the reference comes from an external source.
# when the reference comes from an external source.
def
markdown_reference_pattern
def
markdown_reference_pattern
%r{
%r{
#{
reference_pattern
}
#{
reference_pattern
}
(
#{
reference_postfix
}
|
#{
reference_postfix_escaped
}
)
(
#{
reference_postfix
}
|
#{
reference_postfix_escaped
}
)
(?!
\w
)
}x
}x
end
end
...
...
spec/lib/banzai/filter/project_reference_filter_spec.rb
View file @
77c53f61
...
@@ -24,9 +24,9 @@ describe Banzai::Filter::ProjectReferenceFilter do
...
@@ -24,9 +24,9 @@ describe Banzai::Filter::ProjectReferenceFilter do
expect
(
reference_filter
(
act
).
to_html
).
to
eq
(
CGI
.
escapeHTML
(
exp
))
expect
(
reference_filter
(
act
).
to_html
).
to
eq
(
CGI
.
escapeHTML
(
exp
))
end
end
it
'
ignores references with text after the > sign
'
do
it
'
allows references with text after the > character
'
do
exp
=
act
=
"Hey
#{
reference
}
foo"
doc
=
reference_filter
(
"Hey
#{
reference
}
foo"
)
expect
(
reference_filter
(
act
).
to_html
).
to
eq
CGI
.
escapeHTML
(
exp
)
expect
(
doc
.
css
(
'a'
).
first
.
attr
(
'href'
)).
to
eq
urls
.
project_url
(
subject
)
end
end
%w(pre code a style)
.
each
do
|
elem
|
%w(pre code a style)
.
each
do
|
elem
|
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment