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
1
Merge Requests
1
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
nexedi
gitlab-ce
Commits
84b2576d
Commit
84b2576d
authored
Sep 24, 2020
by
Jean Dupuis
Committed by
Stan Hu
Sep 24, 2020
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
205151-match trailing slash in GitLab-Flavored Markdown References
parent
b4991678
Changes
5
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
19 additions
and
2 deletions
+19
-2
app/models/concerns/referable.rb
app/models/concerns/referable.rb
+1
-1
changelogs/unreleased/issue_205151.yml
changelogs/unreleased/issue_205151.yml
+4
-0
ee/app/models/ee/epic.rb
ee/app/models/ee/epic.rb
+1
-1
ee/spec/lib/banzai/filter/epic_reference_filter_spec.rb
ee/spec/lib/banzai/filter/epic_reference_filter_spec.rb
+7
-0
spec/lib/banzai/filter/issue_reference_filter_spec.rb
spec/lib/banzai/filter/issue_reference_filter_spec.rb
+6
-0
No files found.
app/models/concerns/referable.rb
View file @
84b2576d
...
...
@@ -85,7 +85,7 @@ module Referable
\/
#{
route
.
is_a?
(
Regexp
)
?
route
:
Regexp
.
escape
(
route
)
}
\/
#{
pattern
}
(?<path>
(
\/
[a-z0-9_=-]+)*
(
\/
[a-z0-9_=-]+)*
\/
*
)?
(?<query>
\?
[a-z0-9_=-]+
...
...
changelogs/unreleased/issue_205151.yml
0 → 100644
View file @
84b2576d
title
:
'
Rendering
trailing
slash
in
reference
links
(issue
205151)'
merge_request
:
42484
author
:
type
:
fixed
ee/app/models/ee/epic.rb
View file @
84b2576d
...
...
@@ -170,7 +170,7 @@ module EE
\/
-
\/
epics
\/
(?<epic>
\d
+)
(?<path>
(
\/
[a-z0-9_=-]+)*
(
\/
[a-z0-9_=-]+)*
\/
*
)?
(?<query>
\?
[a-z0-9_=-]+
...
...
ee/spec/lib/banzai/filter/epic_reference_filter_spec.rb
View file @
84b2576d
...
...
@@ -189,6 +189,7 @@ RSpec.describe Banzai::Filter::EpicReferenceFilter do
context
'url reference'
do
let
(
:link
)
{
urls
.
group_epic_url
(
epic
.
group
,
epic
)
}
let
(
:text
)
{
"Check
#{
link
}
"
}
let
(
:project
)
{
create
(
:project
)
}
before
do
epic
.
update_attribute
(
:group_id
,
another_group
.
id
)
...
...
@@ -205,6 +206,12 @@ RSpec.describe Banzai::Filter::EpicReferenceFilter do
it
'includes default classes'
do
expect
(
doc
(
text
).
css
(
'a'
).
first
.
attr
(
'class'
)).
to
eq
(
'gfm gfm-epic has-tooltip'
)
end
it
'matches link reference with trailing slash'
do
doc2
=
reference_filter
(
"Fixed (
#{
link
}
/.)"
)
expect
(
doc2
).
to
match
(
%r{
\(
#{
Regexp
.
escape
(
epic
.
to_reference
(
group
))
}
\.\)
}
)
end
end
context
'full cross-refererence in a link href'
do
...
...
spec/lib/banzai/filter/issue_reference_filter_spec.rb
View file @
84b2576d
...
...
@@ -296,6 +296,12 @@ RSpec.describe Banzai::Filter::IssueReferenceFilter do
.
to
eq
reference
end
it
'link with trailing slash'
do
doc
=
reference_filter
(
"Fixed (
#{
issue_url
+
"/"
}
.)"
)
expect
(
doc
.
to_html
).
to
match
(
%r{
\(
<a.+>
#{
Regexp
.
escape
(
issue
.
to_reference
(
project
))
}
</a>
\.\)
}
)
end
it
'links with adjacent text'
do
doc
=
reference_filter
(
"Fixed (
#{
reference
}
.)"
)
...
...
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