Skip to content

Show attachments by name and kind instead of by URL - #532

Merged
robzolkos merged 2 commits into
mainfrom
attachment-emoji
Sep 30, 2026
Merged

robzolkos merged 2 commits into
mainfrom
attachment-emoji

Conversation

@robzolkos

@robzolkos robzolkos commented Sep 30, 2026 •

Copy link
Copy Markdown
Collaborator

Images in a thread showed as Image: name → url. HEY's own attachment URLs (/rails/active_storage/blobs/redirect/…) run to a couple of lines each and give the reader nothing useful, so a message with a few photos turned into a wall of links.

  • An image now shows as 📷 name. The name is still the link: an image on the web can be selected with Tab, the status row shows its full URL, and Enter opens it. HEY's own attachments open from the Attachments box with o, as before.
  • Other files are marked by kind: 🎬 video, 🎵 audio, 📄 PDF or document, 📎 anything else (all of these used to be 📎).
  • --json and --markdown keep each image's URL, so scripts and agents still get it.

Why these emoji: 🖼️ and 🎞️ were suggested, but both need an invisible U+FE0F to show as emoji, and terminals disagree on whether that makes them one cell wide or two, which shifts everything after them on the line. It's the same problem the peace cover art hit. 📷 🎬 🎵 📄 📎 are emoji on their own and take two cells everywhere.

Pairs with #531, which shows a long link in full in the status row. Once both are in, hiding an image's URL in the body loses nothing.

Basecamp card: https://app.basecamp.com/2914079/buckets/48521764/card_tables/cards/10357135568

Recorded against the local dev server: a message with a web image, a photo, a PDF, a video and an audio file. Each take opens the thread and presses Tab once to select the web image.

Before After
before after

Summary by cubic

Shows thread attachments by kind and name instead of image URLs, so a message full of photos no longer becomes a wall of long links.

  • An image now renders as 📷 name; the name still links to the web image, and the status row shows its full destination when selected.
  • Other files get kind markers: 🎬 video, 🎵 audio, 📄 PDF or document, 📎 anything else (all previously used 📎).
  • When an image's label looks like a URL and isn't just the filename it points at, the real destination is written out beside it so the link can't be disguised.
  • The emoji were chosen because 🖼️ and 🎞️ need an invisible U+FE0F variation selector, and terminals disagree on how wide that makes the glyph.
  • --json and --markdown output keep each image's URL, so scripts and agents still get it.

Written for commit bc21fca. Summary will update on new commits.

Review in cubic

An image in a thread read "Image: name → url", and HEY's own attachment URLs
are long enough to fill a couple of lines each with nothing a reader can use.
An image now reads "📷 name". Its name is still the link, so an image on the
web can be selected with Tab and the status row shows where it goes; HEY's own
attachments open from the Attachments box as before. Other files are marked by
kind: 🎬 video, 🎵 audio, 📄 a PDF or document, 📎 anything else.

These emoji are all drawn as emoji without a variation selector, so every
terminal gives them the same two cells. 🖼️ and 🎞️ need U+FE0F, and terminals
disagree on how wide that makes them.

The Markdown in --json keeps each image's URL.
Copilot AI balanced review requested due to automatic review settings September 30, 2026 16:48
@robzolkos
robzolkos requested a review from a team as a code owner September 30, 2026 16:48

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Copilot review overview

🟡 Changes recommended

URL-shaped image labels can conceal a different hyperlink destination.

Review effort: Balanced
Findings: 1 High severity

Open (1)
What changed in this PR

Replaces verbose attachment URLs with concise, type-specific markers while retaining image links in machine-readable output.

Changes:

  • Renders images as 📷 name and adds icons for other attachment types.
  • Preserves selectable image destinations and updates tests/documentation.
  • One deceptive-link security regression remains.

[!TIP]
If you aren't ready for review, convert to a draft PR.
Click "Convert to draft" or run gh pr ready --undo.
Click "Ready for review" or run gh pr ready to reengage.

File Description
internal/​tui/​mail_test.go Updates attachment rendering expectations.
internal/​markdown/​style.go Hides image URLs and adds camera styling.
internal/​markdown/​render_test.go Tests named, selectable images.
internal/​htmlutil/​markdown.go Assigns attachment icons by media type.
internal/​htmlutil/​markdown_test.go Tests attachment classification.
internal/​htmlutil/​markdown_safety_test.go Updates safe serialization expectations.
docs/​tui.md Documents attachment markers and image links.

💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

Comment thread internal/markdown/style.go
With the URL hidden, an image labelled https://bank.example/login could link to
somewhere else entirely and nothing on screen would say so. A web image whose
label could pass for a URL, and is not just the name of the file it points at,
now has its destination written out beside it, the way a link's label does.
@robzolkos
robzolkos merged commit dc44d41 into main Sep 30, 2026
25 checks passed
@robzolkos
robzolkos deleted the attachment-emoji branch September 30, 2026 17:02
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants