FIX: escape regex chars when searching site texts

This commit is contained in:
Maja Komel
2018-09-02 09:25:57 +02:00
committed by Sam
parent f5e0356fb2
commit 182d9a4666
2 changed files with 4 additions and 2 deletions

View File

@@ -68,7 +68,7 @@ module I18n
target = opts[:backend] || backend
results = opts[:overridden] ? {} : target.search(config.locale, query)
regexp = /#{query}/i
regexp = /#{Regexp.escape(query)}/i
(overrides_by_locale(locale) || {}).each do |k, v|
results.delete(k)
results[k] = v if (k =~ regexp || v =~ regexp)