diff options
author | Claire McQuin <claire@getchef.com> | 2014-09-19 11:41:36 -0700 |
---|---|---|
committer | Claire McQuin <claire@getchef.com> | 2014-09-22 11:22:29 -0700 |
commit | 09976bed9e8fd8434c4272f5ca2d3376eb3cd28a (patch) | |
tree | 9ce554f581f67c0545050d5a9c26f582a10ecb7f | |
parent | 2b02ca90ee35031b0735a7f952ae46177875010f (diff) | |
download | chef-09976bed9e8fd8434c4272f5ca2d3376eb3cd28a.tar.gz |
Escape path for globbing.
-rw-r--r-- | lib/chef/cookbook/cookbook_version_loader.rb | 7 |
1 files changed, 4 insertions, 3 deletions
diff --git a/lib/chef/cookbook/cookbook_version_loader.rb b/lib/chef/cookbook/cookbook_version_loader.rb index 47258c4d4e..5c9de6b8ca 100644 --- a/lib/chef/cookbook/cookbook_version_loader.rb +++ b/lib/chef/cookbook/cookbook_version_loader.rb @@ -2,6 +2,7 @@ require 'chef/cookbook_version' require 'chef/cookbook/chefignore' require 'chef/cookbook/metadata' +require 'chef/util/path_helper' class Chef class Cookbook @@ -212,7 +213,7 @@ class Chef end def load_root_files - Dir.glob(File.join(cookbook_path, '*'), File::FNM_DOTMATCH).each do |file| + Dir.glob(File.join(Chef::Util::PathHelper.escape_glob(cookbook_path), '*'), File::FNM_DOTMATCH).each do |file| next if File.directory?(file) next if File.basename(file) == UPLOADED_COOKBOOK_VERSION_FILE cookbook_settings[:root_filenames][file[@relative_path, 1]] = file @@ -220,7 +221,7 @@ class Chef end def load_recursively_as(category, category_dir, glob) - file_spec = File.join(cookbook_path, category_dir, '**', glob) + file_spec = File.join(Chef::Util::PathHelper.escape_glob(cookbook_path, category_dir), '**', glob) Dir.glob(file_spec, File::FNM_DOTMATCH).each do |file| next if File.directory?(file) cookbook_settings[category][file[@relative_path, 1]] = file @@ -228,7 +229,7 @@ class Chef end def load_as(category, *path_glob) - Dir[File.join(cookbook_path, *path_glob)].each do |file| + Dir[File.join(Chef::Util::PathHelper.escape_glob(cookbook_path), *path_glob)].each do |file| cookbook_settings[category][file[@relative_path, 1]] = file end end |