Repository navigation
[BUGFIX] Improve DOI handling - #91
Merged
Merged
Conversation
tinzog
added a commit
that referenced
this pull request
Nov 12, 2026
Follow-up to #91, which strips prefixes from DOIs and links only values that look like a DOI. - Move normalization, validation and URL generation into the new DoiUtility; Publication::getDoi() returns the normalized value and the new Publication::getDoiUrl() the resolver URL, or an empty string for an invalid DOI. - Remove the f:startsWith check from LinkBlock.html and LinkBlock-Inline.html. The ViewHelper exists only since typo3fluid/fluid 4.5, so the citation list failed on early TYPO3 13.4 releases. The partials now check doiUrl. - Strip LaTeX \url{...} including the braces, combined prefixes such as "DOI: https://doi.org/...", www.doi.org and "DOI 10...." with a space. Drop the multiline flag, so prefixes are removed at the start only. - Accept only values matching 10.<registrant code>/<suffix without whitespace>, so text such as "10. Auflage" or values with several lines are shown as text instead of a broken link. - Percent-encode the DOI suffix in the resolver URL, so DOIs containing #, ?, <, > or ; resolve correctly. Related: #93 Related: https://projekte.in2code.de/issues/85317
Contributor
|
Thanks a lot for this PR, @YKWeyer! Wrong DOI values from editors pose a real problem .
What changed:
Thanks again for your contribution! |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Issue
Most of the DOIs imported by our editors do not respect the expected DOI format (starting with
10.), leading to incorrect URLs being generated in the frontend (the most common beinghttps://dx.doi.org/https://doi.org/10. …, because editors save the entire URL in the DOI field).Suggested changes
doi.orgonly when the returned DOI is matching the expected format (starting with10.)doi.orginstead ofdx.doi.orgaccording to the DOI Resolution Documentation:Resolves #93