Skip to content

Commit

Permalink
handle wrong response format from handle server
Browse files Browse the repository at this point in the history
  • Loading branch information
Martin Fenner committed May 8, 2020
1 parent 35c2265 commit e3e401d
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion app/jobs/url_job.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down

0 comments on commit e3e401d

Please sign in to comment.