diff options
author | David Yip <yipdw@member.fsf.org> | 2018-06-05 02:49:28 -0500 |
---|---|---|
committer | David Yip <yipdw@member.fsf.org> | 2018-06-05 02:49:28 -0500 |
commit | a640c322c19013647cbd19ac907dd18b57c2b1b8 (patch) | |
tree | 8f50ca6a05dd4c381f311db7d84256974b4d4933 /app | |
parent | 37d495eeeb810127e0c6c62bff865c1ba66f45c8 (diff) |
Escape metacharacters in non-whole-word keyword mutes. Fixes #533.
Also addresses #463.
Diffstat (limited to 'app')
-rw-r--r-- | app/models/glitch/keyword_mute.rb | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/app/models/glitch/keyword_mute.rb b/app/models/glitch/keyword_mute.rb index e7cbbe617..7d0002afd 100644 --- a/app/models/glitch/keyword_mute.rb +++ b/app/models/glitch/keyword_mute.rb @@ -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 |