aboutsummaryrefslogtreecommitdiffstats
path: root/app/models
diff options
context:
space:
mode:
Diffstat (limited to 'app/models')
-rw-r--r--app/models/censor_rule.rb7
1 files changed, 2 insertions, 5 deletions
diff --git a/app/models/censor_rule.rb b/app/models/censor_rule.rb
index 4548a3a71..4e96dc55a 100644
--- a/app/models/censor_rule.rb
+++ b/app/models/censor_rule.rb
@@ -43,10 +43,6 @@ class CensorRule < ActiveRecord::Base
end
end
- def binary_replacement
- self.text.gsub(/./, 'x')
- end
-
def apply_to_text!(text)
if text.nil?
return nil
@@ -59,7 +55,8 @@ class CensorRule < ActiveRecord::Base
if binary.nil?
return nil
end
- binary.gsub!(self.text, self.binary_replacement)
+ to_replace = regexp? ? Regexp.new(self.text, Regexp::MULTILINE) : self.text
+ binary.gsub!(to_replace){ |match| match.gsub(/./, 'x') }
end
def for_admin_column