summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authordanielsdeleo <dan@getchef.com>2015-02-23 10:50:31 -0800
committerdanielsdeleo <dan@getchef.com>2015-02-23 10:50:31 -0800
commit19396342b0f1fdc4b88ce98251b0170f09e3c773 (patch)
tree613bdd16e2b4c56fcb6173768f987f5388b7996a /lib
parent21b2f7843dd2de72ae2226e92e1daa7ed4eec03c (diff)
downloadchef-zero-19396342b0f1fdc4b88ce98251b0170f09e3c773.tar.gz
Validate that revision_id is not empty
Diffstat (limited to 'lib')
-rw-r--r--lib/chef_zero/endpoints/policies_endpoint.rb2
1 files changed, 2 insertions, 0 deletions
diff --git a/lib/chef_zero/endpoints/policies_endpoint.rb b/lib/chef_zero/endpoints/policies_endpoint.rb
index 4803d0d..ebb6303 100644
--- a/lib/chef_zero/endpoints/policies_endpoint.rb
+++ b/lib/chef_zero/endpoints/policies_endpoint.rb
@@ -58,6 +58,8 @@ module ChefZero
def validate_revision_id(request, req_object)
if !req_object.key?("revision_id")
error(400, "Must specify 'revision_id' in JSON")
+ elsif req_object["revision_id"].empty?
+ error(400, "'revision_id' field in JSON cannot be an empty string")
elsif req_object["revision_id"].size > 255
error(400, "'revision_id' field in JSON must be 255 characters or fewer")
elsif req_object["revision_id"] !~ /^[\-[:alnum:]_\.\:]+$/