about summary refs log tree commit diff
diff options
context:
space:
mode:
authorbeatrix <beatrix.bitrot@gmail.com>2018-05-06 11:32:22 -0400
committerGitHub <noreply@github.com>2018-05-06 11:32:22 -0400
commite56639258a0d12a7ca3cfcfe528da441341e78eb (patch)
tree44bdabf9e585c7a50fca3632718ead51f4075d5a
parent35a1a3171fdf7f9f4e7a6c3086e12e68f336f64b (diff)
parentb25278180a5a53572222e7c5784cb2abbff96217 (diff)
Merge pull request #458 from monsterpit-daggertooth/glitch-fix-escape-metachars-in-mutes
Escape regex metachars in keyword mutes
-rw-r--r--app/models/glitch/keyword_mute.rb2
1 files changed, 1 insertions, 1 deletions
diff --git a/app/models/glitch/keyword_mute.rb b/app/models/glitch/keyword_mute.rb
index f9c380f39..17ebc5b5e 100644
--- a/app/models/glitch/keyword_mute.rb
+++ b/app/models/glitch/keyword_mute.rb
@@ -70,7 +70,7 @@ class Glitch::KeywordMute < ApplicationRecord
 
     def make_regex_text
       kws = keywords.map! do |whole_word, keyword|
-        whole_word ? boundary_regex_for_keyword(keyword) : /(?i:#{keyword})/
+        whole_word ? boundary_regex_for_keyword(keyword) : /(?i:#{Regexp.escape(keyword)})/
       end
 
       Regexp.union(kws).source