summaryrefslogtreecommitdiff
path: root/lib/bundler/compact_index_client/updater.rb
diff options
context:
space:
mode:
authorHiroshi SHIBATA <[email protected]>2020-12-08 16:36:29 +0900
committerHiroshi SHIBATA <[email protected]>2020-12-08 17:30:02 +0900
commit473f9d2df0ddd7fdb5cc73fa3ad49b2f19f22b06 (patch)
tree6b39312502d32474da0157f5d55620fabd6454ea /lib/bundler/compact_index_client/updater.rb
parent4aca77edde91f826aa243e268bf1ef5214530583 (diff)
Merge prepare version of Bundler 2.2.0
Notes
Notes: Merged: https://github.com/ruby/ruby/pull/3864
Diffstat (limited to 'lib/bundler/compact_index_client/updater.rb')
-rw-r--r--lib/bundler/compact_index_client/updater.rb10
1 files changed, 5 insertions, 5 deletions
diff --git a/lib/bundler/compact_index_client/updater.rb b/lib/bundler/compact_index_client/updater.rb
index 40232019bc..66d1735583 100644
--- a/lib/bundler/compact_index_client/updater.rb
+++ b/lib/bundler/compact_index_client/updater.rb
@@ -22,13 +22,13 @@ module Bundler
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
@@ -66,8 +66,8 @@ module Bundler
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
@@ -75,7 +75,7 @@ module Bundler
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)