summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLamont Granquist <lamont@scriptkiddie.org>2018-04-02 09:57:03 -0700
committerLamont Granquist <lamont@scriptkiddie.org>2018-04-02 09:57:03 -0700
commit4259037620736898cbb11dd9dc3c6908e880455e (patch)
treedea9a3d5977a6761ec40a00340145ab688f0217a
parenta002b8925b302224751e82ece3b84bb28428a449 (diff)
downloadchef-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>
-rw-r--r--lib/chef/file_content_management/tempfile.rb6
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.