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
b263a33c
Commit
b263a33c
authored
May 25, 2015
by
Robert Speicher
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Better handle label references that aren't actually references
Fixes #1690
parent
2651c8a9
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
10 additions
and
3 deletions
+10
-3
lib/gitlab/markdown/label_reference_filter.rb
lib/gitlab/markdown/label_reference_filter.rb
+3
-3
spec/lib/gitlab/markdown/label_reference_filter_spec.rb
spec/lib/gitlab/markdown/label_reference_filter_spec.rb
+7
-0
No files found.
lib/gitlab/markdown/label_reference_filter.rb
View file @
b263a33c
...
@@ -84,11 +84,11 @@ module Gitlab
...
@@ -84,11 +84,11 @@ module Gitlab
#
#
# Returns a Hash.
# Returns a Hash.
def
label_params
(
id
,
name
)
def
label_params
(
id
,
name
)
if
id
>
0
if
name
{
id:
id
}
else
# TODO (rspeicher): Don't strip single quotes if we decide to only use double quotes for surrounding.
# TODO (rspeicher): Don't strip single quotes if we decide to only use double quotes for surrounding.
{
name:
name
.
tr
(
'\'"'
,
''
)
}
{
name:
name
.
tr
(
'\'"'
,
''
)
}
else
{
id:
id
}
end
end
end
end
end
end
...
...
spec/lib/gitlab/markdown/label_reference_filter_spec.rb
View file @
b263a33c
...
@@ -149,5 +149,12 @@ module Gitlab::Markdown
...
@@ -149,5 +149,12 @@ module Gitlab::Markdown
end
end
end
end
end
end
describe
'edge cases'
do
it
'gracefully handles non-references matching the pattern'
do
exp
=
act
=
'(format nil "~0f" 3.0) ; 3.0'
expect
(
filter
(
act
).
to_html
).
to
eq
exp
end
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