Skip to content

Commit

Permalink
fix: DOI resolution
Browse files Browse the repository at this point in the history
records could be uploaded with external DOIs
in that case, they needn't have DATACITE_PREFIX as prefix
correct way is to get DOI from `"pids"` dict
  • Loading branch information
martinobersteiner committed Oct 30, 2024
1 parent 439e92b commit 21d337f
Showing 1 changed file with 2 additions and 3 deletions.
5 changes: 2 additions & 3 deletions invenio_records_lom/resources/serializers/ui/schema.py
Original file line number Diff line number Diff line change
Expand Up @@ -230,9 +230,8 @@ def get_classifications(self, obj: dict) -> list[str]:

def get_doi(self, obj: dict) -> str:
"""Get DOI."""
prefix = current_app.config["DATACITE_PREFIX"]
pid = obj["id"]
return f"https://doi.org/{prefix}/{pid}"
doi = obj.get("pids", {}).get("doi", {}).get("identifier", "")
return f"https://doi.org/{doi}"


class LOMUILinkSchema(LOMUIBaseSchema):
Expand Down

0 comments on commit 21d337f

Please sign in to comment.