Skip to content

fix(doi link): show appropriate DOI link in test(any) environment#2269

Open
fenekku wants to merge 1 commit intoinveniosoftware:masterfrom
fenekku:fix_datacite_test_link_in_citation
Open

fix(doi link): show appropriate DOI link in test(any) environment#2269
fenekku wants to merge 1 commit intoinveniosoftware:masterfrom
fenekku:fix_datacite_test_link_in_citation

Conversation

@fenekku
Copy link
Copy Markdown
Contributor

@fenekku fenekku commented Mar 9, 2026

This fixes DOI links shown in citations.

Related to inveniosoftware/invenio-app-rdm#3356 .

Copy link
Copy Markdown
Contributor

@max-moser max-moser left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good from my perspective; just a few questions to make sure I understand everything correctly before accepting 😃

record_dumped.setdefault("_extras", {})
record_dumped["_extras"]["links"] = record.get("links", {})

return get_citation_string(record_dumped, record["id"], style_filepath, locale)
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just for my understanding: Effectively, the "protocol" for get_citation_string() gets extended so that if an _extras field with a DOI link is present, then that will be used to replace the default doi.org link?
In this code path (serialize_object()) that will always be the case; external calls can use it if they want, or keep using it without (in which case the logic is backwards-compatible).

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Effectively, the "protocol" for get_citation_string() gets extended so that if an _extras field with a DOI link is present, then that will be used to replace the default doi.org link?

Yes that's right. I didn't want to add additional keyword arguments to get_citation_string as it would be getting christmas tree like and the doi link seemed like it really had to do with the serialized record. All the replacements and fetching of that data is very backwards compatible/cautious so doesn't alter anything unduly.

result = serializer.serialize_object(full_record_to_dict)

expected = (
"Nielsen, L. H.and B. Tom. Inveniordm. v1.0, InvenioRDM, 2018–Sept. 2020, "
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think that'd be an issue in citeproc, but is there a space missing between the the end of the first author and and? 👀

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Oh good eye on that one. It's indeed the citeproc's MLA citation that is like that e.g., https://zenodo.org/records/18927380 (and select MLA) :/ Not much we can do for now.

invenio-communities>=23.0.0,<24.0.0
invenio-drafts-resources>=8.0.0,<9.0.0
invenio-records-resources>=9.0.0,<10.0.0
invenio-records-resources>=9.1.0,<10.0.0
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just wondering; this PR looks pretty self-contained, I couldn't find anything that obviously needs a dependency bump?
If it's useful, it can of course stay.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ah yeah this wasn't related to this PR directly but I bumped into it when running tests: this commit 179949e introduced import of DateFacet, but DateFacet are only available in invenio-records==9.1.0+, so that dependency had to be bumped.

@fenekku fenekku requested a review from max-moser March 9, 2026 19:24
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

Status: 👀 In review

Development

Successfully merging this pull request may close these issues.

2 participants