Skip to content

Show images uploaded to a macOS host in the chat instead of their paths - #606

Open
thiblahute wants to merge 1 commit into
powerfooI:mainfrom
thiblahute:upstream/chat-images
Open

thiblahute wants to merge 1 commit into
powerfooI:mainfrom
thiblahute:upstream/chat-images

Conversation

@thiblahute

Copy link
Copy Markdown
Collaborator

Summary

Show an image uploaded to a macOS host in the chat, not its path.

Why

macOS's TMPDIR ends with a slash (/var/folders/.../T/), so an image uploaded through SSH to a macOS host got a path with a doubled slash: /var/folders/.../T//roamgate-uploads-501/upload-.../img-....png. The chat only recognises an uploaded image (messageImagePieces, #562) by a path with single separators, so it showed that path as text.

What changed

  • server/src/http/terminal-upload.ts: the remote upload script strips TMPDIR's trailing slashes before building the upload root, so the path sent to the agent is clean.
  • web/src/chatImages.ts: the uploaded-image pattern also accepts repeated separators, so images uploaded before this change still show.

Verification

  • bun test server/src/http/terminal-upload.test.ts web/src/chatImages.test.ts: new tests "the remote script's path has no doubled slash when TMPDIR ends with one" and "takes a remote macOS upload, whose TMPDIR ends with a slash"; both fail on main.
  • bun run format:check, bun run lint, bun run typecheck:bun, bun run build:web, bun run test:quick with an isolated HOME/TMPDIR.
  • Asset budget: unchanged (initial JS 832.3/833 KiB, gzip 256.7/257 KiB).

Manual checks

  • From a chat on an SSH connection to a macOS host, attach an image and send it: the chat shows the image, and the agent got a path without //.

macOS's TMPDIR ends with a slash, so an image uploaded through SSH to a
macOS host got a path like `/var/folders/.../T//roamgate-uploads-501/...`.
The chat only recognises an uploaded image by a path with single
separators, so it showed that path as text instead of the image.

The remote upload script now strips TMPDIR's trailing slashes, so the
path sent to the agent is clean, and the chat also recognises the doubled
slash in paths uploaded before.
@github-actions github-actions Bot added the enhancement New feature or request label Nov 20, 2026

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant