summaryrefslogtreecommitdiff
path: root/lib/chef/cookbook_version.rb
diff options
context:
space:
mode:
authorScott McGillivray <scott.mcgillivray@gmail.com>2018-08-22 23:47:19 -0400
committerScott McGillivray <scott.mcgillivray@gmail.com>2018-09-05 01:56:34 -0400
commit7ccfb96bacbfe7c5aa3bc19eb79653701fbf04ab (patch)
treee4316116457d1754b24b0628e1b47fd8cee793cf /lib/chef/cookbook_version.rb
parent74ffa11134240e0fd7af9651af1758911914f47c (diff)
downloadchef-7ccfb96bacbfe7c5aa3bc19eb79653701fbf04ab.tar.gz
Add fix for filespecificity regex
Signed-off-by: Scott McGillivray <scott.mcgillivray@gmail.com>
Diffstat (limited to 'lib/chef/cookbook_version.rb')
-rw-r--r--lib/chef/cookbook_version.rb4
1 files changed, 2 insertions, 2 deletions
diff --git a/lib/chef/cookbook_version.rb b/lib/chef/cookbook_version.rb
index 343b037c8b..07ee501ff7 100644
--- a/lib/chef/cookbook_version.rb
+++ b/lib/chef/cookbook_version.rb
@@ -296,9 +296,9 @@ class Chef
# we're just going to make cookbook_files out of these and make the
# cookbook find them by filespecificity again. but it's the shortest
# path to "success" for now.
- if manifest_record_path =~ /(#{Regexp.escape(segment.to_s)}\/[^\/]+\/#{Regexp.escape(dirname)})\/.+$/
+ if manifest_record_path =~ /(#{Regexp.escape(segment.to_s)}\/[^\/]*\/?#{Regexp.escape(dirname)})\/.+$/
specificity_dirname = $1
- non_specific_path = manifest_record_path[/#{Regexp.escape(segment.to_s)}\/[^\/]+\/#{Regexp.escape(dirname)}\/(.+)$/, 1]
+ non_specific_path = manifest_record_path[/#{Regexp.escape(segment.to_s)}\/[^\/]*\/?#{Regexp.escape(dirname)}\/(.+)$/, 1]
# Record the specificity_dirname only if it's in the list of
# valid preferences
if filenames_by_pref[specificity_dirname]