fix(blueprint-metadata): resolve bare github.com URIs to raw metadata JSON#3219
Merged
Merged
Conversation
… JSON Blueprints can register an on-chain metadataUri that points at the repo's GitHub HTML page (e.g. https://github.com/<owner>/<repo>). The dapp then fetches that URL expecting JSON, receives HTML, and the blueprint renders as unavailable. Teach resolveBlueprintMetadataFetchUrl to translate a bare github.com/<owner>/<repo> URL (optionally with a trailing slash or .git suffix) into the canonical raw.githubusercontent.com/<owner>/<repo>/main/metadata/blueprint-metadata.json path. ipfs:// handling is unchanged; any URL with a sub-path (e.g. /tree/main/...) is still passed through as-is, and arbitrary HTTPS URLs still flow through rewriteLocalhostUrlForBrowser. To unblock unit testing, the resolver moves into its own metadataFetchUrl.ts so the test file does not transitively pull in the authoring module's import.meta.env reference. authoring.ts re-exports the function so the public API is unchanged.
This was referenced May 21, 2026
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.
Summary
metadataUrithat points at the repo's GitHub HTML page (https://github.com/<owner>/<repo>). The dappfetch()-es that URL expecting JSON, receives HTML,parseBlueprintMetadataJsonTextbails out, and every affected blueprint renders as unavailable.resolveBlueprintMetadataFetchUrlto translate a baregithub.com/<owner>/<repo>URL (optionally with a trailing slash or.gitsuffix) intoraw.githubusercontent.com/<owner>/<repo>/main/metadata/blueprint-metadata.json.ipfs://handling is untouched, URLs with sub-paths (/tree/main/...) are passed through unchanged, and any other HTTPS URL still flows throughrewriteLocalhostUrlForBrowser.masterinstead ofmainwill 404 for now — that's accepted as a follow-up (fixable on-chain viaupdateBlueprint, or we can add amain→masterfallback later). The four repos with on-chain registrations today all default tomain.metadataFetchUrl.tsso unit tests don't transitively pull in the authoring module'simport.meta.envreference;authoring.tsre-exports the function so the public API is identical.Test plan
yarn nx test tangle-shared-ui --testPathPattern=authoring— 6 new cases (ipfs, bare GitHub, trailing slash,.git, sub-path passthrough, unrelated HTTPS passthrough), all pass.yarn nx test tangle-shared-ui— full suite green (32 tests).yarn nx test tangle-cloud— full suite green (109 tests).yarn nx lint tangle-shared-ui— clean.yarn nx build tangle-cloud— clean.