fix(harvester): normalize malformed URN identifiers#866
Open
TahaKhan998 wants to merge 1 commit into
Open
Conversation
8 tasks
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.
Part of #861.
Solves no.7 of https://codimd.web.cern.ch/s/DBWeY3d5y
This fixes the harvester failure metadata.related_identifiers.identifier: Invalid URN identifier, which was found for INSPIRE#1714668. INSPIRE marks the identifier as a URN but provides it in a malformed form such as http://nbnurn:nbn:de:..., while CDS-RDM expects it to start with urn:. The related identifier mapper now extracts the actual urn: value, validates and normalizes it with idutils, and only adds it when it is valid. Values that cannot be safely corrected are skipped and reported as transformation errors instead of reaching CDS record validation. The same handling is used for both persistent and external identifiers, while the existing behavior for valid URNs, DOIs, and other identifier schemes stays unchanged. Tests cover the real failing value, existing valid URNs, and values that cannot be corrected.