Skip to content

Commit

Permalink
Merge branch 'rs-issue-1690' into 'master'
Browse files Browse the repository at this point in the history
Better handle label references that aren't actually references

Fixes #1690

See merge request !705
  • Loading branch information
dzaporozhets committed May 26, 2015
2 parents 8ea443b + b263a33 commit 08102ad
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 3 deletions.
6 changes: 3 additions & 3 deletions lib/gitlab/markdown/label_reference_filter.rb
Expand Up @@ -84,11 +84,11 @@ def render_colored_label(label)
#
# Returns a Hash.
def label_params(id, name)
if id > 0
{ id: id }
else
if name
# TODO (rspeicher): Don't strip single quotes if we decide to only use double quotes for surrounding.
{ name: name.tr('\'"', '') }
else
{ id: id }
end
end
end
Expand Down
7 changes: 7 additions & 0 deletions spec/lib/gitlab/markdown/label_reference_filter_spec.rb
Expand Up @@ -149,5 +149,12 @@ module Gitlab::Markdown
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

0 comments on commit 08102ad

Please sign in to comment.