Skip to content
This repository has been archived by the owner on Apr 14, 2021. It is now read-only.

Commit

Permalink
Auto merge of #6336 - bundler:segiddins/updater-use-more-filesystem-a…
Browse files Browse the repository at this point in the history
…ccess, r=colby-swandale

[CompactIndexClient::Updater] Use filesystem_access when copying files

### What was the end-user problem that led to this PR?

The problem was users could see the error template when they do not have write permissions to their temporary directory.

Closes #6289

### What was your diagnosis of the problem?

My diagnosis was we need to use `SharedHelpers.filesystem_access` when writing files.

### What is your fix for the problem, implemented in this PR?

My fix wraps usage of `cp`

(cherry picked from commit b7b847f)
  • Loading branch information
bundlerbot authored and colby-swandale committed Apr 20, 2018
1 parent c47fc5d commit e43d3de
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion lib/bundler/compact_index_client/updater.rb
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,9 @@ def update(local_path, remote_path, retrying = nil)

# first try to fetch any new bytes on the existing file
if retrying.nil? && local_path.file?
FileUtils.cp local_path, local_temp_path
SharedHelpers.filesystem_access(local_temp_path) do
FileUtils.cp local_path, local_temp_path
end
headers["If-None-Match"] = etag_for(local_temp_path)
headers["Range"] =
if local_temp_path.size.nonzero?
Expand Down

0 comments on commit e43d3de

Please sign in to comment.