From 903aa8145e19df5e459779ed3575c04c02661b79 Mon Sep 17 00:00:00 2001 From: Richard Hallett Date: Mon, 3 Feb 2020 18:16:40 +0100 Subject: [PATCH] Fixing potential bad data of identifier being a list datacite/datacite#941 --- viringo/services/datacite.py | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/viringo/services/datacite.py b/viringo/services/datacite.py index 63543e1..ef221a7 100644 --- a/viringo/services/datacite.py +++ b/viringo/services/datacite.py @@ -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'])