Escape metacharacters in non-whole-word keyword mutes. Fixes #533.

Also addresses #463.
This commit is contained in:
David Yip
2018-06-05 02:49:28 -05:00
parent 37d495eeeb
commit a640c322c1
2 changed files with 8 additions and 2 deletions

View File

@@ -50,7 +50,7 @@ class Glitch::KeywordMute < ApplicationRecord
end
def matches?(str)
str =~ (whole_word ? boundary_regex_for_keyword : /#{keyword}/i)
str =~ (whole_word ? boundary_regex_for_keyword : /#{Regexp.escape(keyword)}/i)
end
end