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
Léo-Paul Géneau
gitlab-ce
Commits
1ff896f2
Commit
1ff896f2
authored
Apr 04, 2016
by
Alejandro Rodríguez
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Escaping the `object_link_text` on cross project milestone references
parent
6d9794d4
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
7 additions
and
1 deletion
+7
-1
lib/banzai/filter/milestone_reference_filter.rb
lib/banzai/filter/milestone_reference_filter.rb
+1
-1
spec/lib/banzai/filter/milestone_reference_filter_spec.rb
spec/lib/banzai/filter/milestone_reference_filter_spec.rb
+6
-0
No files found.
lib/banzai/filter/milestone_reference_filter.rb
View file @
1ff896f2
...
@@ -39,7 +39,7 @@ module Banzai
...
@@ -39,7 +39,7 @@ module Banzai
if
context
[
:project
]
==
object
.
project
if
context
[
:project
]
==
object
.
project
super
super
else
else
"
#{
super
}
<i>in
#{
escape_once
(
object
.
project
.
name_with_namespace
)
}
</i>"
.
"
#{
escape_once
(
super
)
}
<i>in
#{
escape_once
(
object
.
project
.
name_with_namespace
)
}
</i>"
.
html_safe
html_safe
end
end
end
end
...
...
spec/lib/banzai/filter/milestone_reference_filter_spec.rb
View file @
1ff896f2
...
@@ -176,5 +176,11 @@ describe Banzai::Filter::MilestoneReferenceFilter, lib: true do
...
@@ -176,5 +176,11 @@ describe Banzai::Filter::MilestoneReferenceFilter, lib: true do
it
'contains cross project content'
do
it
'contains cross project content'
do
expect
(
result
.
css
(
'a'
).
first
.
text
).
to
eq
"
#{
milestone
.
name
}
in
#{
project_name
}
"
expect
(
result
.
css
(
'a'
).
first
.
text
).
to
eq
"
#{
milestone
.
name
}
in
#{
project_name
}
"
end
end
it
'escapes the name attribute'
do
allow_any_instance_of
(
Milestone
).
to
receive
(
:title
).
and_return
(
%{"></a>whatever<a title="}
)
doc
=
reference_filter
(
"See
#{
reference
}
"
)
expect
(
doc
.
css
(
'a'
).
first
.
text
).
to
eq
"
#{
milestone
.
name
}
in
#{
project_name
}
"
end
end
end
end
end
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