diff --git a/lib/topics_filter.rb b/lib/topics_filter.rb index 8a7090194e7..52e27c99ffd 100644 --- a/lib/topics_filter.rb +++ b/lib/topics_filter.rb @@ -363,7 +363,7 @@ class TopicsFilter break if key_prefix && key_prefix != "-" value.scan( - /\A(?([a-zA-Z0-9\-]+)(?[,+])?([a-zA-Z0-9\-]+)?(\k[a-zA-Z0-9\-]+)*)\z/, + /\A(?([\p{N}\p{L}\-]+)(?[,+])?([\p{N}\p{L}\-]+)?(\k[\p{N}\p{L}\-]+)*)\z/, ) do |tag_names, delimiter| match_all = if delimiter == "," diff --git a/spec/lib/topics_filter_spec.rb b/spec/lib/topics_filter_spec.rb index 3b373bb053f..93398876345 100644 --- a/spec/lib/topics_filter_spec.rb +++ b/spec/lib/topics_filter_spec.rb @@ -869,6 +869,19 @@ RSpec.describe TopicsFilter do .pluck(:id), ).to contain_exactly(topic_without_tag.id, topic_with_group_only_tag.id) end + + describe "when query string is tag:日べé1" do + before { tag.update!(name: "日べé1") } + + it "should return topics that are tagged with the specified tag" do + expect( + TopicsFilter + .new(guardian: Guardian.new) + .filter_from_query_string("tag:日べé1") + .pluck(:id), + ).to contain_exactly(topic_with_tag.id, topic_with_tag_and_tag2.id) + end + end end describe "when filtering by topic author" do