mirror of
https://github.com/discourse/discourse.git
synced 2025-03-06 11:19:51 +00:00
FIX: search server side error in rare condition
This commit is contained in:
parent
0b55416742
commit
e501936405
@ -374,6 +374,8 @@ class Search
|
|||||||
exact = true
|
exact = true
|
||||||
|
|
||||||
slug = match.to_s.split(":")
|
slug = match.to_s.split(":")
|
||||||
|
next if slug.empty?
|
||||||
|
|
||||||
if slug[1]
|
if slug[1]
|
||||||
# sub category
|
# sub category
|
||||||
parent_category_id = Category.where(slug: slug[0].downcase, parent_category_id: nil).pluck(:id).first
|
parent_category_id = Category.where(slug: slug[0].downcase, parent_category_id: nil).pluck(:id).first
|
||||||
|
@ -837,6 +837,9 @@ describe Search do
|
|||||||
|
|
||||||
results = Search.new('#777').execute
|
results = Search.new('#777').execute
|
||||||
expect(results.posts.length).to eq(0)
|
expect(results.posts.length).to eq(0)
|
||||||
|
|
||||||
|
results = Search.new('xxx #:').execute
|
||||||
|
expect(results.posts.length).to eq(0)
|
||||||
end
|
end
|
||||||
|
|
||||||
context 'tags' do
|
context 'tags' do
|
||||||
|
Loading…
x
Reference in New Issue
Block a user