Skip to content

fix: prioritize special package handlers over meta.source fallback in getPath()#1276

Open
JorisHeadease wants to merge 1 commit intoHL7:masterfrom
JorisHeadease:fix/meta-source-link-fallback-order
Open

fix: prioritize special package handlers over meta.source fallback in getPath()#1276
JorisHeadease wants to merge 1 commit intoHL7:masterfrom
JorisHeadease:fix/meta-source-link-fallback-order

Conversation

@JorisHeadease
Copy link
Copy Markdown

Bug

SpecMapManager.getPath() uses meta.source (passed as the def parameter) as a web hyperlink for resources from dependency packages before the special package type handlers (Simplifier, VSAC, DICOM, etc.) are reached.

meta.source is a provenance URI per the FHIR spec — not a navigable web URL. The special package handlers exist specifically to generate correct links for their respective package types, but are never invoked when meta.source is non-null.

Call sites passing meta.source as def

Call site File Line
getResourcePath() PublisherLoader.java 77
getIgPath() PublisherLoader.java 97
getCorePath() LoaderUtils.java 30, 34

All pass resource.getMeta().getSource() as the def parameter.

Fallback order before this fix

1. paths map (spec.internals)  → return if found
2. getSpecialPath()            → return if match
3. def (meta.source) != null   → return def          ← SHORT-CIRCUITS EVERYTHING BELOW
4. special package handlers    → Simplifier/VSAC/DICOM/PhinVads (never reached)
5. URI regex fallback
6. return null

Fallback order after this fix

1. paths map (spec.internals)  → return if found
2. getSpecialPath()            → return if match
3. special package handlers    → Simplifier/VSAC/DICOM/PhinVads (now reached)
4. def (meta.source) != null   → last-resort fallback
5. URI regex fallback
6. return null

Impact

For Simplifier-published packages (e.g. nictiz.fhir.nl.r4.zib2020) that lack spec.internals and have meta.source set, this produces broken hyperlinks in the generated IG HTML.

Before: Link points to http://decor.nictiz.nl/fhir/4.0/zib2020bbr- (truncated meta.source provenance URI)

After: Link points to https://simplifier.net/resolve?scope=nictiz.fhir.nl.r4.zib2020@0.12.0-beta.4&canonical=... (correct Simplifier redirect)

A reproduction project is attached to #1275.

Fixes #1275

Move the meta.source (def) fallback in getPath() to after the special
package type handlers (Simplifier, VSAC, DICOM, PhinVads, etc.).

These handlers are purpose-built to generate correct web URLs for
their respective package types. Previously, a non-null meta.source
value would short-circuit these handlers, returning a provenance URI
as a web hyperlink. This produced broken links for any package that
lacks spec.internals and has meta.source set (e.g. Simplifier-published
packages like nictiz.fhir.nl.r4.zib2020).

meta.source is retained as a last-resort fallback after the special
handlers, in case no handler matches.

Fixes HL7#1275
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Development

Successfully merging this pull request may close these issues.

Broken hyperlinks: meta.source used as web URL instead of resource canonical URL

1 participant