Skip to content

fix(chat): show images by root-relative and relative URLs - #442

Merged
vite-hub[bot] merged 1 commit into
mainfrom
fix/chat-relative-image-urls
Nov 16, 2026
Merged

vite-hub[bot] merged 1 commit into
mainfrom
fix/chat-relative-image-urls

Conversation

@onmax

@onmax onmax commented Nov 16, 2026

Copy link
Copy Markdown
Owner

MessageParts shows no image when a file part's URL is relative, such as /uploads/a.png. An app that serves its own uploads gets a bare file name instead of the picture, in Vue, React and Svelte. ViteHub works around it by overriding the file slot in @vite-hub/ui.

read() accepted only absolute http and https URLs, data image URLs and blob URLs as image sources. This PR also accepts a URL relative to the page. It resolves the URL against a stand-in https origin with the URL parser, so the check reads it the same way the browser does: /uploads/a.png, ../a.png and //cdn.example.com/a.png load, while javascript:, java\tscript:, file: and an empty string still don't. The src stays as written, so the browser resolves it against the page. Links (href) are unchanged.

The new tests fail on main and pass here: read() cases for the accepted and refused URLs, and a render of /uploads/a.png in Vue, React and Svelte. Svelte is server-rendered in the test for the first time, from a small Vite SSR bundle of the components. vp test in packages/chat (16 tests), vp lint, the package build with publint, and its Vite Doctor pass. I checked server-rendered HTML only, not a browser.

🤖 Generated with Claude Code

@chatgpt-codex-connector

Copy link
Copy Markdown

You have reached your Codex usage limits for code reviews. You can see your limits in the Codex usage dashboard.

@pullfrog pullfrog Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

✅ No new issues found. No P0 or P1 findings remain.

Reviewed changes — Reviewed the relative-image URL handling, its public contract, and regression coverage across all three chat renderers.

  • Relative image sources: read() accepts root-relative, path-relative, query-relative, and protocol-relative image URLs while preserving the original src and rejecting non-web schemes.
  • Unchanged link policy: Image-source support expands without changing file links, downloads, or source links; existing data-image and blob support is retained.
  • Framework coverage: Adds URL acceptance/rejection tests and a Vue, React, and Svelte rendering regression test, including a new bundled Svelte SSR helper.
  • Public documentation: Updates the Block.image type documentation and Chat page to describe relative image URLs.

Validation: all 16 chat tests, targeted lint and strict typechecking, the chat package build with publint, and its Vite Doctor pass. Additional public-reader checks cover both file and reasoning-file parts. Browser behavior was not exercised; the full workspace build reached [timed out after 120000ms], so only the focused package build is confirmed complete.

Pullfrog  | View workflow run | Using gpt-6.1-sol(xhigh) | 𝕏

@pkg-pr-new

pkg-pr-new Bot commented Nov 16, 2026

Copy link
Copy Markdown

Open in StackBlitz

comark-annotate

pnpm add https://pkg.pr.new/comark-annotate@442

comark-badge

pnpm add https://pkg.pr.new/comark-badge@442

comark-bundle

pnpm add https://pkg.pr.new/comark-bundle@442

comark-cards

pnpm add https://pkg.pr.new/comark-cards@442

comark-carousel

pnpm add https://pkg.pr.new/comark-carousel@442

comark-cast

pnpm add https://pkg.pr.new/comark-cast@442

comark-charts

pnpm add https://pkg.pr.new/comark-charts@442

comark-chat

pnpm add https://pkg.pr.new/comark-chat@442

comark-chips

pnpm add https://pkg.pr.new/comark-chips@442

comark-cjk

pnpm add https://pkg.pr.new/comark-cjk@442

comark-code

pnpm add https://pkg.pr.new/comark-code@442

comark-code-notes

pnpm add https://pkg.pr.new/comark-code-notes@442

comark-colors

pnpm add https://pkg.pr.new/comark-colors@442

comark-comments

pnpm add https://pkg.pr.new/comark-comments@442

comark-critic

pnpm add https://pkg.pr.new/comark-critic@442

comark-deflist

pnpm add https://pkg.pr.new/comark-deflist@442

comark-details

pnpm add https://pkg.pr.new/comark-details@442

comark-diagrams

pnpm add https://pkg.pr.new/comark-diagrams@442

comark-diff

pnpm add https://pkg.pr.new/comark-diff@442

comark-embed

pnpm add https://pkg.pr.new/comark-embed@442

comark-fields

pnpm add https://pkg.pr.new/comark-fields@442

comark-figure

pnpm add https://pkg.pr.new/comark-figure@442

comark-file-tree

pnpm add https://pkg.pr.new/comark-file-tree@442

comark-footnotes

pnpm add https://pkg.pr.new/comark-footnotes@442

comark-git-graph

pnpm add https://pkg.pr.new/comark-git-graph@442

comark-github

pnpm add https://pkg.pr.new/comark-github@442

comark-icon

pnpm add https://pkg.pr.new/comark-icon@442

comark-include

pnpm add https://pkg.pr.new/comark-include@442

comark-keys

pnpm add https://pkg.pr.new/comark-keys@442

comark-links

pnpm add https://pkg.pr.new/comark-links@442

comark-linter

pnpm add https://pkg.pr.new/comark-linter@442

comark-magic-move

pnpm add https://pkg.pr.new/comark-magic-move@442

comark-mark

pnpm add https://pkg.pr.new/comark-mark@442

markdown-it-to-comark

pnpm add https://pkg.pr.new/markdown-it-to-comark@442

marked-to-comark

pnpm add https://pkg.pr.new/marked-to-comark@442

comark-mathml

pnpm add https://pkg.pr.new/comark-mathml@442

comark-media

pnpm add https://pkg.pr.new/comark-media@442

comark-metrics

pnpm add https://pkg.pr.new/comark-metrics@442

migrate-to-comark

pnpm add https://pkg.pr.new/migrate-to-comark@442

comark-outline

pnpm add https://pkg.pr.new/comark-outline@442

comark-properties

pnpm add https://pkg.pr.new/comark-properties@442

comark-qr

pnpm add https://pkg.pr.new/comark-qr@442

comark-quiz

pnpm add https://pkg.pr.new/comark-quiz@442

comark-reading-time

pnpm add https://pkg.pr.new/comark-reading-time@442

remark-to-comark

pnpm add https://pkg.pr.new/remark-to-comark@442

comark-sources

pnpm add https://pkg.pr.new/comark-sources@442

comark-steps

pnpm add https://pkg.pr.new/comark-steps@442

comark-table

pnpm add https://pkg.pr.new/comark-table@442

comark-tabs

pnpm add https://pkg.pr.new/comark-tabs@442

comark-tests

pnpm add https://pkg.pr.new/comark-tests@442

comark-time

pnpm add https://pkg.pr.new/comark-time@442

comark-ui

pnpm add https://pkg.pr.new/comark-ui@442

comark-xref

pnpm add https://pkg.pr.new/comark-xref@442

comark-zoom

pnpm add https://pkg.pr.new/comark-zoom@442

commit: 6fdca63

@vite-hub
vite-hub Bot merged commit 02f6fcb into main Nov 16, 2026
6 checks passed
@vite-hub
vite-hub Bot deleted the fix/chat-relative-image-urls branch November 16, 2026 23:38
@github-actions github-actions Bot mentioned this pull request Nov 16, 2026
@vite-hub

vite-hub Bot commented Nov 17, 2026

Copy link
Copy Markdown
Contributor
Session Status Started Duration
Pending Completed Not started —

Latest result

Pull request merged.

Final answers

Session

Pull request merged.

@github-actions github-actions Bot mentioned this pull request Nov 17, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant