utils/curl: force utf-8 encoding for text content
This commit is contained in:
parent
bb3d97030c
commit
4575ddf909
@ -359,6 +359,7 @@ module Utils
|
|||||||
|
|
||||||
if status.success?
|
if status.success?
|
||||||
file_contents = File.read(file.path)
|
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
|
file_hash = Digest::SHA2.hexdigest(file_contents) if hash_needed
|
||||||
end
|
end
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user