Skip to content

Commit 657c14f

Browse files
dougmdanielsdeleo
authored andcommitted
[CHEF-1509] strip drive letter from backup_filename
1 parent cdd16dc commit 657c14f

1 file changed

Lines changed: 1 addition & 0 deletions

File tree

‎chef/lib/chef/provider/file.rb‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -179,6 +179,7 @@ def backup(file=nil)
179179
time = Time.now
180180
savetime = time.strftime("%Y%m%d%H%M%S")
181181
backup_filename = "#{@new_resource.path}.chef-#{savetime}"
182+
backup_filename = backup_filename.sub(/^([A-Za-z]:)/, "") #strip drive letter on Windows
182183
# if :file_backup_path is nil, we fallback to the old behavior of
183184
# keeping the backup in the same directory. We also need to to_s it
184185
# so we don't get a type error around implicit to_str conversions.

0 commit comments

Comments
 (0)