mirror of
https://github.com/discourse/discourse.git
synced 2025-05-30 15:28:37 +08:00
FIX: Don’t raise on some search terms
Currently, when certain search terms are provided, this can lead to `Search.need_segmenting?` raising an error because it makes `URI#path` to return `nil` instead of a string. This patch forces a cast to string so it won’t raise anymore.
This commit is contained in:

committed by
Loïc Guitaut

parent
e68748318e
commit
fe1098ebac
@ -31,6 +31,14 @@ RSpec.describe Search do
|
||||
it { is_expected.not_to be_need_segmenting(data) }
|
||||
end
|
||||
|
||||
context "when data makes `URI#path` return `nil`" do
|
||||
let(:data) { "in:solved%20category:50%20order:likes" }
|
||||
|
||||
it "doesn’t raise an error" do
|
||||
expect { search.need_segmenting?(data) }.not_to raise_error
|
||||
end
|
||||
end
|
||||
|
||||
context "when data is something else" do
|
||||
let(:data) { "text" }
|
||||
|
||||
|
Reference in New Issue
Block a user