summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorBryan Newbold <bnewbold@robocracy.org>2020-03-26 13:58:32 -0700
committerBryan Newbold <bnewbold@robocracy.org>2020-03-26 14:09:15 -0700
commitec82404f0d0ad6b92491a1cb90a823d421857348 (patch)
tree3fe1c732b812a4f59cadd069e47d92ecfa4e040e
parent675e311c7bc3d1875c3fea0608b6bc7db6e71f4f (diff)
downloadfatcat-ec82404f0d0ad6b92491a1cb90a823d421857348.tar.gz
fatcat-ec82404f0d0ad6b92491a1cb90a823d421857348.zip
datacite: nameIdentifier corner case
Works around a bug in production: AttributeError: 'NoneType' object has no attribute 'replace' (datacite.py:724) NOTE: there are no tests for this code path
-rw-r--r--python/fatcat_tools/importers/datacite.py3
1 files changed, 2 insertions, 1 deletions
diff --git a/python/fatcat_tools/importers/datacite.py b/python/fatcat_tools/importers/datacite.py
index db4709c2..5b736787 100644
--- a/python/fatcat_tools/importers/datacite.py
+++ b/python/fatcat_tools/importers/datacite.py
@@ -721,7 +721,8 @@ class DataciteImporter(EntityImporter):
name_scheme = nid.get('nameIdentifierScheme', '') or ''
if not name_scheme.lower() == "orcid":
continue
- orcid = nid.get('nameIdentifier', '').replace('https://orcid.org/', '')
+ orcid = nid.get('nameIdentifier') or ''
+ orcid = orcid.replace('https://orcid.org/', '')
if not orcid:
continue
creator_id = self.lookup_orcid(orcid)