From: Tom Clegg Date: Fri, 14 Feb 2014 04:48:40 +0000 (-0800) Subject: Fix crash in collections.provenance when a script_parameter is a Fixnum. X-Git-Tag: 1.1.0~2756 X-Git-Url: https://git.arvados.org/arvados.git/commitdiff_plain/b436539142666c2553a74363fbf7e34fefc9912b Fix crash in collections.provenance when a script_parameter is a Fixnum. --- diff --git a/services/api/app/controllers/arvados/v1/collections_controller.rb b/services/api/app/controllers/arvados/v1/collections_controller.rb index feed5cecb0..dc95ea064d 100644 --- a/services/api/app/controllers/arvados/v1/collections_controller.rb +++ b/services/api/app/controllers/arvados/v1/collections_controller.rb @@ -61,21 +61,20 @@ class Arvados::V1::CollectionsController < ApplicationController end def script_param_edges(visited, sp) - if sp and not sp.empty? - case sp - when Hash - sp.each do |k, v| - script_param_edges(visited, v) - end - when Array - sp.each do |v| - script_param_edges(visited, v) - end - else - m = collection_uuid(sp) - if m - generate_provenance_edges(visited, m) - end + case sp + when Hash + sp.each do |k, v| + script_param_edges(visited, v) + end + when Array + sp.each do |v| + script_param_edges(visited, v) + end + when String + return if sp.empty? + m = collection_uuid(sp) + if m + generate_provenance_edges(visited, m) end end end diff --git a/services/api/test/fixtures/jobs.yml b/services/api/test/fixtures/jobs.yml index 4adf985c6d..9780067b35 100644 --- a/services/api/test/fixtures/jobs.yml +++ b/services/api/test/fixtures/jobs.yml @@ -95,6 +95,7 @@ barbaz: script_version: 7def43a4d3f20789dda4700f703b5514cc3ed250 script_parameters: input: fa7aeb5140e2848d39b416daeef4ffc5+45 + an_integer: 1 started_at: <%= 3.minute.ago.to_s(:db) %> finished_at: <%= 2.minute.ago.to_s(:db) %> running: false