From e3e401d3df8438d2ec38ca0948331873ac80591d Mon Sep 17 00:00:00 2001 From: Martin Fenner Date: Fri, 8 May 2020 20:56:42 +0200 Subject: [PATCH] handle wrong response format from handle server --- app/jobs/url_job.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/jobs/url_job.rb b/app/jobs/url_job.rb index e94180227..afe8c4753 100644 --- a/app/jobs/url_job.rb +++ b/app/jobs/url_job.rb @@ -11,7 +11,7 @@ def perform(doi_id) if doi.present? response = Doi.get_doi(doi: doi.doi, agency: doi.agency) - url = if response.is_a?(String) ? nil : response.body.dig('data', 'values', 0, 'data', 'value') + url = response.is_a?(String) ? nil : response.body.dig('data', 'values', 0, 'data', 'value') if url.present? if (doi.is_registered_or_findable? || %w(europ).include?(doi.provider_id)) && doi.minted.blank? doi.update_attributes(url: url, minted: Time.zone.now)