Skip to content

Commit 5a4b5fb

Browse files
committed
Fix handling of new versions and custom DOIs
1 parent a674a83 commit 5a4b5fb

File tree

1 file changed

+11
-0
lines changed

1 file changed

+11
-0
lines changed

caltechdata_api/caltechdata_edit.py

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -211,6 +211,17 @@ def caltechdata_edit(
211211
"provider": "datacite",
212212
"client": "datacite",
213213
}
214+
# If we are making a new version, we only want to look for custom DOIs
215+
if version == True and "identifiers" in metadata:
216+
for identifier in metadata["identifiers"]:
217+
if identifier["identifierType"] == "DOI":
218+
doi = identifier["identifier"]
219+
prefix = doi.split("/")[0]
220+
if prefix != repo_prefix:
221+
pids["doi"] = {
222+
"identifier": doi,
223+
"provider": "external",
224+
}
214225

215226
# If no metadata is provided, use existing. Otherwise customize provided
216227
# metadata

0 commit comments

Comments
 (0)