From 09eac98a857dfd0856c77d45e913a69dfd6821dd Mon Sep 17 00:00:00 2001 From: Makyen Date: Sat, 1 Apr 2023 11:17:57 -0700 Subject: [PATCH] Constant '' is frozen. --- app/models/spam_wave.rb | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/app/models/spam_wave.rb b/app/models/spam_wave.rb index daa3ad32..9b070980 100644 --- a/app/models/spam_wave.rb +++ b/app/models/spam_wave.rb @@ -68,8 +68,8 @@ def post_matches?(post, site_ids = nil) post_text = '' if post_text.nil? # UTF-8 -> UTF-16 -> UTF-8 idea and code from [answer to: "ruby 1.9: invalid byte sequence in UTF-8"](https://stackoverflow.com/a/8873922) # by [RubenLaguna](https://stackoverflow.com/users/90580/rubenlaguna), which is under a CC BY-SA 3.0 license. - post_text.encode!('UTF-16', 'UTF-8', invalid: :replace, replace: '') - post_text.encode!('UTF-8', 'UTF-16') + post_text = post_text.encode!('UTF-16', 'UTF-8', invalid: :replace, replace: '') + post_text = post_text.encode!('UTF-8', 'UTF-16') Rails.logger.debug "[spam-wave] id: #{id}: #{name}:: post #{f}: encoding: #{post_text.encoding}" return false unless regex.match?(post_text) Rails.logger.debug "[spam-wave] id: #{id}: #{name}:: post_matches?: #{f}: MATCHES: post id: #{post.id}: #{post.title}"