summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorClaire McQuin <claire@getchef.com>2014-09-19 11:38:48 -0700
committerClaire McQuin <claire@getchef.com>2014-09-22 11:22:29 -0700
commit2b02ca90ee35031b0735a7f952ae46177875010f (patch)
tree89c0cb0c70dd13816b2d8996089f851b4e36dc0c
parent60ab3608d7eb3d8498e00deb282f8974e305ad48 (diff)
downloadchef-2b02ca90ee35031b0735a7f952ae46177875010f.tar.gz
Escape path for globbing.
-rw-r--r--lib/chef/data_bag.rb4
1 files changed, 2 insertions, 2 deletions
diff --git a/lib/chef/data_bag.rb b/lib/chef/data_bag.rb
index 99808d0609..528be3f2c4 100644
--- a/lib/chef/data_bag.rb
+++ b/lib/chef/data_bag.rb
@@ -90,7 +90,7 @@ class Chef
raise Chef::Exceptions::InvalidDataBagPath, "Data bag path '#{path}' is invalid"
end
- names += Dir.glob(File.join(path, "*")).map{|f|File.basename(f)}.sort
+ names += Dir.glob(File.join(Chef::Util::PathHelper.escape_glob(path), "*")).map{|f|File.basename(f)}.sort
end
names.inject({}) {|h, n| h[n] = n; h}
else
@@ -116,7 +116,7 @@ class Chef
raise Chef::Exceptions::InvalidDataBagPath, "Data bag path '#{path}' is invalid"
end
- Dir.glob(File.join(path, name.to_s, "*.json")).inject({}) do |bag, f|
+ Dir.glob(File.join(Chef::Util::PathHelper.escape_glob(path, name.to_s), "*.json")).inject({}) do |bag, f|
item = Chef::JSONCompat.from_json(IO.read(f))
# Check if we have multiple items with similar names (ids) and raise if their content differs