Skip to content

Commit

Permalink
Always pass an encoding option to Zlib::GzipReader.wrap
Browse files Browse the repository at this point in the history
The arity of this method has been -1 since the import, so the
option has been passed always, even if Zlib::GzipReader#initialize
does not take the option.  Actually it takes the option since 1.9.
  • Loading branch information
nobu committed Sep 26, 2019
1 parent bf5bdbd commit 2fcde0f
Showing 1 changed file with 1 addition and 5 deletions.
6 changes: 1 addition & 5 deletions lib/rubygems/package.rb
Expand Up @@ -534,11 +534,7 @@ def load_spec(entry) # :nodoc:
when 'metadata' then
@spec = Gem::Specification.from_yaml entry.read
when 'metadata.gz' then
args = [entry]
args << { :external_encoding => Encoding::UTF_8 } if
Zlib::GzipReader.method(:wrap).arity != 1

Zlib::GzipReader.wrap(*args) do |gzio|
Zlib::GzipReader.wrap(entry, external_encoding: Encoding::UTF_8) do |gzio|
@spec = Gem::Specification.from_yaml gzio.read
end
end
Expand Down

0 comments on commit 2fcde0f

Please sign in to comment.