Skip to content
This repository has been archived by the owner on May 28, 2024. It is now read-only.

Commit

Permalink
allow sandbox URIs in test data to be returned
Browse files Browse the repository at this point in the history
  • Loading branch information
peetucket committed Nov 20, 2023
1 parent 88ac1a9 commit ade2076
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 3 deletions.
5 changes: 4 additions & 1 deletion app/services/orcid_builder.rb
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,9 @@ def orcidid(contributor)
return identifier.uri if identifier.uri
return identifier.value if identifier.value.start_with?('https://orcid.org/')

URI.join('https://orcid.org/', identifier.value).to_s
# some records have just the ORCIDID without the URL prefix, add it if so, e.g. druid:tp865ng1792
return URI.join('https://orcid.org/', identifier.value).to_s if identifier.source.uri.blank?

URI.join(identifier.source.uri, identifier.value).to_s
end
end
4 changes: 2 additions & 2 deletions spec/indexers/descriptive_metadata_indexer_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,7 @@
type: 'person',
identifier: [
{
uri: 'https://orcid.org/1111-2222-3333-4444',
uri: 'https://sandbox.orcid.org/1111-2222-3333-4444',
type: 'ORCID',
source: {
code: 'orcid'
Expand Down Expand Up @@ -404,7 +404,7 @@
'originInfo_place_placeTerm_tesim' => 'Garden City, N. Y',
'topic_ssim' => %w[Economics cats],
'topic_tesim' => %w[cats Economics],
'contributor_orcids_ssim' => ['https://orcid.org/0000-1111-2222-3333', 'https://orcid.org/1111-2222-3333-4444', 'https://orcid.org/0000-0001-5321-289X']
'contributor_orcids_ssim' => ['https://orcid.org/0000-1111-2222-3333', 'https://sandbox.orcid.org/1111-2222-3333-4444', 'https://orcid.org/0000-0001-5321-289X']
)
end
# rubocop:enable Style/StringHashKeys
Expand Down

0 comments on commit ade2076

Please sign in to comment.