Ruby 3.2: Changeset.normalize_comments raises Encoding::CompatibilityError if the string contains an invalid UTF-8 byte sequence (#38099, #38100).

Patch by Go MAEDA.


git-svn-id: https://svn.redmine.org/redmine/trunk@22000 e93f8b46-1217-0410-a6f0-8f06a7374b81
This commit is contained in:
Go MAEDA
2022-12-26 01:36:44 +00:00
parent cec30f9a05
commit f186e614ee

View File

@@ -296,7 +296,7 @@ class Changeset < ActiveRecord::Base
class << self class << self
# Strips and reencodes a commit log before insertion into the database # Strips and reencodes a commit log before insertion into the database
def normalize_comments(str, encoding) def normalize_comments(str, encoding)
Changeset.to_utf8(str.to_s.strip, encoding) Changeset.to_utf8(str.to_s, encoding).strip
end end
def to_utf8(str, encoding) def to_utf8(str, encoding)