fix: render http(s) source references as external links#556
Merged
nashsu merged 2 commits intoJul 15, 2026
Conversation
Wiki pages occasionally carry an http(s) URL in their `sources:` frontmatter (e.g. an LLM-emitted web citation). The frontmatter panel resolved every source against raw/sources/ and flagged any non-file entry with a "Source not found" warning — but a URL is not a missing local file, so the amber warning was misleading. Add `resolveSourceReference()` that classifies a source as external (http/https via URL parsing), local, or missing, and render external sources as clickable cards opened through the system browser (tauri-plugin-opener) instead of not-found warnings. Non-http URL-like values (e.g. `javascript:`) stay classified as missing.
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.
Problem
Wiki pages sometimes carry an
http(s)URL in theirsources:frontmatter — e.g. an LLM-emitted web citation. The frontmatter panel resolves everysources:entry againstraw/sources/and, when no local file matches, renders the card with a dashed border and an amber "Source not found in raw/sources/" warning.A URL is not a missing local file, so this flags a valid external reference as broken. The existing data model keeps
sources:for local file references (ingest, web-clip, and the deep-research import in #178 all materialize content intoraw/sources/), so URL entries only reachsources:via LLM output or manual edits — and today they degrade to a misleading warning rather than a usable link.Change
resolveSourceReference()inwiki-page-resolver.tsthat classifies asources:entry as:external— anhttp:/https:URL (validated vianew URL())local— resolves to a file underraw/sources/orwiki/sources/missing— neitherexternalsources as clickable cards opened in the system browser viatauri-plugin-opener(same pattern as the About / API-server links), with no warning icon.localandmissingbehavior is unchanged. Non-http URL-like values (e.g.javascript:) are treated asmissing, not external.Test plan
npm run test:mocks— 1600 tests pass, incl. newresolveSourceReferencecases (http/https external, local, missing, null source root,javascript:rejection)npm run typecheck— cleansources:contains anhttps://URL → the card renders as an external link and opens the browser on click, with no amber "not found" warning