open-design/apps/web/tests/runtime
YOMXXX 97ed479c6b
fix(web): route chat file links to workspace preview instead of new window (#1239) (#2576)
* fix(web): route chat file links to workspace preview instead of new window (#1239)

Chat-emitted markdown links like `[template.html](template.html)` rendered
as `<a target="_blank">` with no click handler. In Electron that hits
`setWindowOpenHandler` and creates a new `od://` BrowserWindow; relative
hrefs have no base so the new window can't resolve them and the user
lands on the home screen — the file they wanted to preview is never
shown.

Detect in-project file paths in chat markdown via a new
`asInProjectFilePath` helper and route them through the existing
`requestOpenFile` workspace tab opener. External URLs, `mailto:`,
`#anchors`, absolute paths and `..` traversal keep their default
browser-link behavior. The `renderMarkdown(options)` extension is
backwards-compatible: existing callers (file viewer, system reminders)
keep their default `target="_blank"` behavior when the option is
omitted.

Closes #1239.

* fix(web): decode percent-encoded chat file links before workspace open (#1239)

Chat markdown frequently emits links as URL-encoded text — `Mock%20Page.html`
for a file named `Mock Page.html`, multi-byte sequences for non-ASCII
filenames. The workspace tab opener (`requestOpenFile` →
`FileWorkspace`) matches by literal on-disk file name, so handing it
the raw `%20`-encoded form silently misses the existing tab and the
user sees nothing happen on click — the exact regression #1239
reopened against.

Decode after the literal `..` check and re-check `..` on the
decoded form so a `%2E%2E` smuggling attempt cannot bypass the
traversal guard. Malformed encodings fall through to `null` (default
browser link behavior) instead of letting URIError crash the
renderer.

The same gap was flagged on the earlier draft PR #1255 by mrcfps and
lefarcen (P2) but never landed there; this PR now covers it with
five new regression tests (ASCII spaces, nested subdirs, UTF-8 byte
sequences, malformed `%`, percent-encoded traversal).
2026-05-23 11:48:07 +08:00
..
app-route-export.test.ts feat: add Orbit activity summaries (#681) 2026-05-08 14:27:46 +08:00
design-template-deck-nav.test.ts Fix editorial deck navigation (#2173) 2026-05-19 19:30:30 +08:00
exports.test.ts refactor desktop host bridge (#2246) 2026-05-19 18:27:05 +08:00
file-ops.test.ts feat(web): implement file operations summary in assistant messages 2026-05-11 23:25:38 +08:00
in-project-link.test.ts fix(web): route chat file links to workspace preview instead of new window (#1239) (#2576) 2026-05-23 11:48:07 +08:00
markdown.linkClick.test.tsx fix(web): route chat file links to workspace preview instead of new window (#1239) (#2576) 2026-05-23 11:48:07 +08:00
markdown.test.tsx fix(web): keep trailing punctuation out of bare chat URLs (#2678) 2026-05-22 15:49:05 +08:00
plugin-source.test.ts feat(web): standardize plugin terminology and enhance UI components 2026-05-13 12:19:29 +08:00
react-component.test.ts chore: enforce test directory conventions (#496) 2026-05-05 15:34:22 +08:00
srcdoc-bridge-empty-targets.test.ts fix(web): allow Comment/Inspect picker to select iframe-backed components (#2254) 2026-05-19 19:26:11 +08:00
srcdoc-deck-bridge-framework-deck.test.ts fix(daemon,web): block pitch-deck placeholder publishes and unbreak framework decks (#2384) 2026-05-20 16:20:34 +08:00
srcdoc-deck-bridge-nested-slides.test.ts fix(web): count nested .slide elements in deck preview bridge (#1542) 2026-05-13 19:42:20 +08:00
srcdoc-palette-css-vars.test.ts test(e2e): align entry coverage with redesigned flows (#2101) 2026-05-19 11:26:40 +08:00
srcdoc-transport.test.ts fix(web): gate srcDoc transport activation on shell ready (#2320) 2026-05-20 11:13:40 +08:00
srcdoc.test.ts fix(web): allow Comment/Inspect picker to select iframe-backed components (#2254) 2026-05-19 19:26:11 +08:00
todos.test.ts fix: stop stale pinned todos after terminal runs (#2321) 2026-05-20 11:13:20 +08:00
tool-renderers.test.tsx fix(web): complete finished tool calls missing results (#1240) 2026-05-11 15:54:11 +08:00