FIX: Remove multiple consecutive dashes from tag names (#24520)
This commit is contained in:
parent
fef14c004c
commit
9f3399ca8f
|
@ -724,8 +724,8 @@ module DiscourseTagging
|
|||
tag.strip!
|
||||
tag.gsub!(/[[:space:]]+/, "-")
|
||||
tag.gsub!(/[^[:word:][:punct:]]+/, "")
|
||||
tag.squeeze!("-")
|
||||
tag.gsub!(TAGS_FILTER_REGEXP, "")
|
||||
tag.squeeze!("-")
|
||||
tag[0...SiteSetting.max_tag_length]
|
||||
end
|
||||
|
||||
|
|
|
@ -1479,6 +1479,11 @@ RSpec.describe DiscourseTagging do
|
|||
it "removes zero-width spaces" do
|
||||
expect(DiscourseTagging.clean_tag("hel\ufefflo")).to eq("hello")
|
||||
end
|
||||
|
||||
it "removes multiple consecutive dashes" do
|
||||
expect(DiscourseTagging.clean_tag("hello---world")).to eq("hello-world")
|
||||
expect(DiscourseTagging.clean_tag("Finances & Accounting")).to eq("finances-accounting")
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
|
|
Loading…
Reference in New Issue