utils/curl: force utf-8 encoding for text content

This commit is contained in:
Alexander Bayandin 2022-05-02 13:57:51 +01:00
parent bb3d97030c
commit 4575ddf909
No known key found for this signature in database
GPG Key ID: DB8BA841834EF987

View File

@ -359,6 +359,7 @@ module Utils
if status.success?
file_contents = File.read(file.path)
file_contents.encode!(Encoding::UTF_8, invalid: :replace) if headers["content-type"]&.start_with?("text/")
file_hash = Digest::SHA2.hexdigest(file_contents) if hash_needed
end