diff options
author | Claire McQuin <claire@getchef.com> | 2014-09-19 12:18:11 -0700 |
---|---|---|
committer | Claire McQuin <claire@getchef.com> | 2014-09-22 11:22:30 -0700 |
commit | 69e9a4f8bf4e80c637badaf8df9de8054cc4ac1e (patch) | |
tree | 5a837292f934552f07153d49294fe4ee568cea81 /lib/chef/file_cache.rb | |
parent | 15bba51d19666133198cd4a7d3b52c9ae8c24dfa (diff) | |
download | chef-69e9a4f8bf4e80c637badaf8df9de8054cc4ac1e.tar.gz |
Escape path for globbing.
Diffstat (limited to 'lib/chef/file_cache.rb')
-rw-r--r-- | lib/chef/file_cache.rb | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/lib/chef/file_cache.rb b/lib/chef/file_cache.rb index 89e934ea05..c2f77bdff6 100644 --- a/lib/chef/file_cache.rb +++ b/lib/chef/file_cache.rb @@ -20,6 +20,7 @@ require 'chef/mixin/create_path' require 'chef/exceptions' require 'chef/json_compat' require 'fileutils' +require 'chef/util/path_helper' class Chef class FileCache @@ -157,9 +158,9 @@ class Chef # [String] - An array of file cache keys matching the glob def find(glob_pattern) keys = Array.new - Dir[File.join(file_cache_path, glob_pattern)].each do |f| + Dir[File.join(Chef::Util::PathHelper.escape_glob(file_cache_path), glob_pattern)].each do |f| if File.file?(f) - keys << f[/^#{Regexp.escape(Dir[file_cache_path].first) + File::Separator}(.+)/, 1] + keys << f[/^#{Regexp.escape(Dir[Chef::Util::PathHelper.escape_glob(file_cache_path)].first) + File::Separator}(.+)/, 1] end end keys |