Skip to content

Commit

Permalink
Merge pull request #440 from iBug/escape-search
Browse files Browse the repository at this point in the history
Escape "%" and "_"  in non-regex search
  • Loading branch information
thesecretmaster committed May 28, 2018
2 parents 1823ad5 + d11355b commit 8d33ca9
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion app/helpers/search_helper.rb
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ def self.parse_search_params(params, symbol, user)
regex_support.each { |k, v| input = input.gsub(k, v) }
else
operation = 'LIKE'
input = '%' + input + '%'
input = '%' + ActiveRecord::Base.sanitize_sql_like(input) + '%'
end

[input, operation]
Expand Down

0 comments on commit 8d33ca9

Please sign in to comment.