diff options
author | Claire McQuin <claire@getchef.com> | 2014-09-19 12:41:48 -0700 |
---|---|---|
committer | Claire McQuin <claire@getchef.com> | 2014-09-22 11:22:30 -0700 |
commit | 296ea46a56dd3057657220de17dc87b8eecb5a7c (patch) | |
tree | a4b31eba528860f9228de7a5eb967d0bde6320f0 /lib | |
parent | ee7f79f699beaf136d93970734a0ec552aabc11b (diff) | |
download | chef-296ea46a56dd3057657220de17dc87b8eecb5a7c.tar.gz |
Excape path for globbing.
Diffstat (limited to 'lib')
-rw-r--r-- | lib/chef/knife/core/object_loader.rb | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/lib/chef/knife/core/object_loader.rb b/lib/chef/knife/core/object_loader.rb index 4ba41c53c3..ba60a7c811 100644 --- a/lib/chef/knife/core/object_loader.rb +++ b/lib/chef/knife/core/object_loader.rb @@ -69,15 +69,15 @@ class Chef # # @api public def find_all_objects(path) - path = File.join(path, '*') + path = File.join(Chef::Util::PathHelper.escape_glob(File.expand_path(path)), '*') path << '.{json,rb}' - objects = Dir.glob(Chef::Util::PathHelper.escape_glob(File.expand_path(path))) + objects = Dir.glob(path) objects.map { |o| File.basename(o) } end def find_all_object_dirs(path) - path = File.join(path, '*') - objects = Dir.glob(Chef::Util::PathHelper.escape_glob(File.expand_path(path))) + path = File.join(Chef::Util::PathHelper.escape_glob(File.expand_path(path)), '*') + objects = Dir.glob(path) objects.delete_if { |o| !File.directory?(o) } objects.map { |o| File.basename(o) } end |