[ruby/net-http] Read in binary mode to get rid of invalid byte sequence

https://github.com/ruby/net-http/commit/38de3d17a7
This commit is contained in:
Nobuyoshi Nakada 2023-03-06 16:03:15 +09:00 committed by git
parent fd0a5659ca
commit c8c3431b0a

View File

@ -2,9 +2,14 @@
name = File.basename(__FILE__, ".gemspec")
version = ["lib", Array.new(name.count("-")+1, "..").join("/")].find do |dir|
break File.foreach(File.join(__dir__, dir, "#{name.tr('-', '/')}.rb")) do |line|
file = File.join(__dir__, dir, "#{name.tr('-', '/')}.rb")
begin
break File.foreach(file, mode: "rb") do |line|
/^\s*VERSION\s*=\s*"(.*)"/ =~ line and break $1
end rescue nil
end
rescue SystemCallError
next
end
end
Gem::Specification.new do |spec|