bundler/lib/bundler/compact_index_client/updater.rb in rubygems-update-3.2.0.rc.2 vs bundler/lib/bundler/compact_index_client/updater.rb in rubygems-update-3.2.0

- old
+ new

@@ -20,17 +20,17 @@ end end def initialize(fetcher) @fetcher = fetcher - require "tmpdir" + require_relative "../vendored_tmpdir" end def update(local_path, remote_path, retrying = nil) headers = {} - Dir.mktmpdir("bundler-compact-index-") do |local_temp_dir| + Bundler::Dir.mktmpdir("bundler-compact-index-") do |local_temp_dir| local_temp_path = Pathname.new(local_temp_dir).join(local_path.basename) # first try to fetch any new bytes on the existing file if retrying.nil? && local_path.file? SharedHelpers.filesystem_access(local_temp_path) do @@ -64,19 +64,19 @@ else local_temp_path.open("w") {|f| f << content } end end - response_etag = (response["ETag"] || "").gsub(%r{\AW/}, "") - if etag_for(local_temp_path) == response_etag + etag = (response["ETag"] || "").gsub(%r{\AW/}, "") + if etag.length.zero? || etag_for(local_temp_path) == etag SharedHelpers.filesystem_access(local_path) do FileUtils.mv(local_temp_path, local_path) end return nil end if retrying - raise MisMatchedChecksumError.new(remote_path, response_etag, etag_for(local_temp_path)) + raise MisMatchedChecksumError.new(remote_path, etag, etag_for(local_temp_path)) end update(local_path, remote_path, :retrying) end rescue Errno::EACCES