Skip to content

Commit

Permalink
Fix non-english characters delete on tags (forem#2579)
Browse files Browse the repository at this point in the history
  • Loading branch information
bolariin authored and benhalpern committed Apr 29, 2019
1 parent 2ea6acc commit 5b03403
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 1 deletion.
2 changes: 1 addition & 1 deletion app/lib/acts_as_taggable_on/tag_parser.rb
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ def clean(string)
return [] if string.blank?

string.downcase.split(",").map do |t|
t.strip.delete(" ").gsub(/[^0-9a-z]/i, "")
t.strip.delete(" ").gsub(/[^[:alnum:]]/i, "")
end
end

Expand Down
4 changes: 4 additions & 0 deletions spec/lib/acts_as_taggable_on/tag_parser_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,10 @@ def create_tag_parser(tag_arr)
tags = ["w0rd", "app|3", "&!tes4@#$%^&*"]
expect(create_tag_parser(tags)).to eq(%w[w0rd app3 tes4])
end
it "allows non-english characters" do
tags = %w[Optimización Καλημέρα Français]
expect(create_tag_parser(tags)).to eq(%w[optimización καλημέρα français])
end
it "returns nothing if nothing is recieved" do
expect(create_tag_parser([])).to eq([])
end
Expand Down

0 comments on commit 5b03403

Please sign in to comment.