Skip to content

Commit

Permalink
Fixing potential bad data of identifier being a list
Browse files Browse the repository at this point in the history
  • Loading branch information
richardhallett committed Feb 3, 2020
1 parent cde2b09 commit 903aa81
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions viringo/services/datacite.py
Original file line number Diff line number Diff line change
Expand Up @@ -128,6 +128,11 @@ def build_metadata(data):
if data['attributes']['identifiers'] is not None:
for identifier in data['attributes']['identifiers']:
if identifier['identifier']:
# Special handling for the fact the API could return bad identifier
# as a list rather than a string
if isinstance(identifier['identifier'], list):
identifier['identifier'] = ','.join(identifier['identifier'])

result.identifiers.append({
'type': identifier['identifierType'],
'identifier': strip_uri_prefix(identifier['identifier'])
Expand Down

0 comments on commit 903aa81

Please sign in to comment.