mirror of
https://github.com/nexu-io/open-design.git
synced 2026-06-01 03:14:35 +07:00
* 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). |
||
|---|---|---|
| .. | ||
| app-route-export.test.ts | ||
| design-template-deck-nav.test.ts | ||
| exports.test.ts | ||
| file-ops.test.ts | ||
| in-project-link.test.ts | ||
| markdown.linkClick.test.tsx | ||
| markdown.test.tsx | ||
| plugin-source.test.ts | ||
| react-component.test.ts | ||
| srcdoc-bridge-empty-targets.test.ts | ||
| srcdoc-deck-bridge-framework-deck.test.ts | ||
| srcdoc-deck-bridge-nested-slides.test.ts | ||
| srcdoc-palette-css-vars.test.ts | ||
| srcdoc-transport.test.ts | ||
| srcdoc.test.ts | ||
| todos.test.ts | ||
| tool-renderers.test.tsx | ||