Escape user input before building regexps
This commit is contained in:
1 parent
25adc82695
commit
b6969c6dd0
2 files changed
+2
-2
No files matched your search
@@ -298,7 +298,7 @@ end
|
||||
keywords = params["q"]
|
||||
keywords = keywords.strip.nil? ? keywords : keywords.strip
|
||||
regexes = keywords.split(/\s+(?=(?:[^"]*"[^"]*")*[^"]*$)/)
|
||||
regex = Regexp.union(regexes.map{|word| Regexp.new(".*"+word+".*", "i")})
|
||||
regex = Regexp.union(regexes.map{|word| Regexp.new(".*"+Regexp.escape(word)+".*", "i")})
|
||||
|
||||
column = table.table_columns.where(:type.in => ["text","editor"])
|
||||
columns = []
|
||||
|
||||
Reference in new issue
Block a user