mirror of
https://github.com/discourse/discourse.git
synced 2025-05-28 13:51:18 +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
@ -228,7 +228,7 @@ class Search
|
||||
|
||||
def self.need_segmenting?(data)
|
||||
return false if data.match?(/\A\d+\z/)
|
||||
!URI.parse(data).path.start_with?("/")
|
||||
!URI.parse(data).path.to_s.start_with?("/")
|
||||
rescue URI::InvalidURIError
|
||||
true
|
||||
end
|
||||
|
Reference in New Issue
Block a user