6277: all that work and missed the basic nil and empty string check!!!
authorradhika <radhika@curoverse.com>
Mon, 15 Jun 2015 15:33:45 +0000 (11:33 -0400)
committerradhika <radhika@curoverse.com>
Mon, 15 Jun 2015 15:33:45 +0000 (11:33 -0400)
sdk/ruby/lib/arvados/keep.rb
sdk/ruby/test/test_keep_manifest.rb

index 62f231f73d0e448c8aa5b61a07a034b9496b099d..3c6b26b765f59c4938465aaa7dcc589187fa7722 100644 (file)
@@ -231,6 +231,10 @@ module Keep
     # Verify that a given manifest is valid according to
     # https://arvados.org/projects/arvados/wiki/Keep_manifest_format
     def self.validate! manifest
+      raise ArgumentError.new "No manifest found" if !manifest
+
+      return true if manifest.empty?
+
       raise ArgumentError.new "Invalid manifest: does not end with newline" if !manifest.end_with?("\n")
       line_count = 0
       manifest.each_line do |line|
index 306d8b381692ef9e4cc029086e33f1233c64c50f..5ed9cfc2b186b6e2122d41a879603054962bd0d3 100644 (file)
@@ -281,6 +281,9 @@ class ManifestTest < Minitest::Test
   end
 
   [
+    [false, nil, "No manifest found"],
+    [true, ""],
+    [false, " ", "Invalid manifest: does not end with newline"],
     [true, ". d41d8cd98f00b204e9800998ecf8427e 0:0:abc.txt\n"],
     [true, ". d41d8cd98f00b204e9800998ecf8427e+0 0:0:abc.txt\n"],
     [true, ". d41d8cd98f00b204e9800998ecf8427e a41d8cd98f00b204e9800998ecf8427e+0 0:0:abc.txt\n"], # 2 locators