diff options
author | Lamont Granquist <lamont@scriptkiddie.org> | 2018-04-02 09:57:03 -0700 |
---|---|---|
committer | Lamont Granquist <lamont@scriptkiddie.org> | 2018-04-02 09:57:03 -0700 |
commit | 4259037620736898cbb11dd9dc3c6908e880455e (patch) | |
tree | dea9a3d5977a6761ec40a00340145ab688f0217a /lib/chef | |
parent | a002b8925b302224751e82ece3b84bb28428a449 (diff) | |
download | chef-4259037620736898cbb11dd9dc3c6908e880455e.tar.gz |
scrub tempfile names
this keeps Tempfile.open from internally barfing on ruby-2.5.1
Signed-off-by: Lamont Granquist <lamont@scriptkiddie.org>
Diffstat (limited to 'lib/chef')
-rw-r--r-- | lib/chef/file_content_management/tempfile.rb | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/lib/chef/file_content_management/tempfile.rb b/lib/chef/file_content_management/tempfile.rb index 9d8a7ea882..c3bf07d92b 100644 --- a/lib/chef/file_content_management/tempfile.rb +++ b/lib/chef/file_content_management/tempfile.rb @@ -1,6 +1,6 @@ # # Author:: Lamont Granquist (<lamont@chef.io>) -# Copyright:: Copyright 2013-2016, Chef Software Inc. +# Copyright:: Copyright 2013-2018, Chef Software Inc. # License:: Apache License, Version 2.0 # # Licensed under the Apache License, Version 2.0 (the "License"); @@ -68,7 +68,7 @@ class Chef # the leading "[.]chef-" here should be considered a public API and should not be changed basename.insert 0, "chef-" basename.insert 0, "." unless Chef::Platform.windows? # dotfile if we're not on windows - basename + basename.scrub end # this is similar to File.extname() but greedy about the extension (from the first dot, not the last dot) @@ -76,7 +76,7 @@ class Chef # complexity here is due to supporting mangling non-UTF8 strings (e.g. latin-1 filenames with characters that are illegal in UTF-8) b = File.basename(@new_resource.path) i = b.index(".") - i.nil? ? "" : b[i..-1] + i.nil? ? "" : b[i..-1].scrub end # Returns the possible directories for the tempfile to be created in. |