DEV: `tag:` filter on `/filter` only supported alphabets and numbers (#21405)
A tag's name can consist of any Unicode characters as well
This commit is contained in:
parent
6f26732551
commit
7d0ef338e4
|
@ -363,7 +363,7 @@ class TopicsFilter
|
|||
break if key_prefix && key_prefix != "-"
|
||||
|
||||
value.scan(
|
||||
/\A(?<tag_names>([a-zA-Z0-9\-]+)(?<delimiter>[,+])?([a-zA-Z0-9\-]+)?(\k<delimiter>[a-zA-Z0-9\-]+)*)\z/,
|
||||
/\A(?<tag_names>([\p{N}\p{L}\-]+)(?<delimiter>[,+])?([\p{N}\p{L}\-]+)?(\k<delimiter>[\p{N}\p{L}\-]+)*)\z/,
|
||||
) do |tag_names, delimiter|
|
||||
match_all =
|
||||
if delimiter == ","
|
||||
|
|
|
@ -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
|
||||
|
|
Loading…
Reference in New Issue