Skip to content

Commit c8c3431

Browse files
nobumatzbot
authored andcommitted
[ruby/net-http] Read in binary mode to get rid of invalid byte sequence
ruby/net-http@38de3d17a7
1 parent fd0a565 commit c8c3431

File tree

1 file changed

+8
-3
lines changed

1 file changed

+8
-3
lines changed

lib/net/http/net-http.gemspec

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,14 @@
22

33
name = File.basename(__FILE__, ".gemspec")
44
version = ["lib", Array.new(name.count("-")+1, "..").join("/")].find do |dir|
5-
break File.foreach(File.join(__dir__, dir, "#{name.tr('-', '/')}.rb")) do |line|
6-
/^\s*VERSION\s*=\s*"(.*)"/ =~ line and break $1
7-
end rescue nil
5+
file = File.join(__dir__, dir, "#{name.tr('-', '/')}.rb")
6+
begin
7+
break File.foreach(file, mode: "rb") do |line|
8+
/^\s*VERSION\s*=\s*"(.*)"/ =~ line and break $1
9+
end
10+
rescue SystemCallError
11+
next
12+
end
813
end
914

1015
Gem::Specification.new do |spec|

0 commit comments

Comments
 (0)