summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorClaire McQuin <claire@getchef.com>2014-09-19 12:41:48 -0700
committerClaire McQuin <claire@getchef.com>2014-09-22 11:22:30 -0700
commit296ea46a56dd3057657220de17dc87b8eecb5a7c (patch)
treea4b31eba528860f9228de7a5eb967d0bde6320f0
parentee7f79f699beaf136d93970734a0ec552aabc11b (diff)
downloadchef-296ea46a56dd3057657220de17dc87b8eecb5a7c.tar.gz
Excape path for globbing.
-rw-r--r--lib/chef/knife/core/object_loader.rb8
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