diff --git a/lib/workers/occurrences_worker.rb b/lib/workers/occurrences_worker.rb index 3ed304b0..d63fa28e 100644 --- a/lib/workers/occurrences_worker.rb +++ b/lib/workers/occurrences_worker.rb @@ -245,7 +245,7 @@ def filter_pii_param(param) when Hash param.each do |representation, value| next if %w(language class_name).include?(representation) - param[representation] = filter_pii_string(value) + param[representation] = filter_pii_param(value) end end end diff --git a/spec/lib/workers/occurrences_worker_spec.rb b/spec/lib/workers/occurrences_worker_spec.rb index a49b8b2d..d7567b60 100644 --- a/spec/lib/workers/occurrences_worker_spec.rb +++ b/spec/lib/workers/occurrences_worker_spec.rb @@ -298,6 +298,14 @@ occ = OccurrencesWorker.new(@params).perform expect(occ.ivars['email']).to eql('[EMAIL?]') end + + it "should handle nils gracefully" do + @params['ivars'] = {"foo" => { "email" => nil }, + "other" => "something"} + expect { + occ = OccurrencesWorker.new(@params).perform + }.not_to raise_error + end end it "should stick any attributes it doesn't recognize into the metadata attribute" do