Better handle label references that aren't actually references
Fixes #1690
This commit is contained in:
parent
2651c8a9aa
commit
b263a33c80
2 changed files with 10 additions and 3 deletions
|
@ -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
|
||||||
|
|
|
@ -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
|
||||||
|
|
Loading…
Reference in a new issue