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.strip!
|
||||||
tag.gsub!(/[[:space:]]+/, "-")
|
tag.gsub!(/[[:space:]]+/, "-")
|
||||||
tag.gsub!(/[^[:word:][:punct:]]+/, "")
|
tag.gsub!(/[^[:word:][:punct:]]+/, "")
|
||||||
tag.squeeze!("-")
|
|
||||||
tag.gsub!(TAGS_FILTER_REGEXP, "")
|
tag.gsub!(TAGS_FILTER_REGEXP, "")
|
||||||
|
tag.squeeze!("-")
|
||||||
tag[0...SiteSetting.max_tag_length]
|
tag[0...SiteSetting.max_tag_length]
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
|
@ -1479,6 +1479,11 @@ RSpec.describe DiscourseTagging do
|
||||||
it "removes zero-width spaces" do
|
it "removes zero-width spaces" do
|
||||||
expect(DiscourseTagging.clean_tag("hel\ufefflo")).to eq("hello")
|
expect(DiscourseTagging.clean_tag("hel\ufefflo")).to eq("hello")
|
||||||
end
|
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
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue