Escape user-supplied regex terms (#17305)
This commit is contained in:
parent
63c3229e36
commit
16c49a5df2
1 changed files with 1 additions and 1 deletions
|
|
@ -45,7 +45,7 @@ module Settings
|
|||
def self.trigger_spam_for?(text:)
|
||||
return false if spam_trigger_terms.empty?
|
||||
|
||||
regexp = Regexp.new("(#{spam_trigger_terms.join('|')})", true)
|
||||
regexp = Regexp.new("(#{spam_trigger_terms.map { |term| Regexp.escape(term) }.join('|')})", true)
|
||||
regexp.match?(text)
|
||||
end
|
||||
end
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue