mirror of
https://github.com/discourse/discourse.git
synced 2025-05-31 00:48:06 +08:00
FIX: a search term containing '& could lead to errors
This also makes sure that the search term in front or after special characters isn't ignored.
This commit is contained in:
@ -832,8 +832,8 @@ class Search
|
||||
ts_config = ActiveRecord::Base.connection.quote(ts_config) if ts_config
|
||||
all_terms = data.scan(/'([^']+)'\:\d+/).flatten
|
||||
all_terms.map! do |t|
|
||||
t.split(/[\)\(&']/)[0]
|
||||
end.compact!
|
||||
t.split(/[\)\(&']/).find(&:present?)
|
||||
end.reject!(&:blank?)
|
||||
|
||||
query = ActiveRecord::Base.connection.quote(
|
||||
all_terms
|
||||
|
Reference in New Issue
Block a user