Skip to content

HTML email nested in a text/html action-text-attachment renders as "📄 attachment" instead of its body #603

Closed

Description

@jeremiahwilson

What happens

Some inbound HTML emails render as nothing but a placeholder, in both hey thread read and the TUI:

"body": "📄 attachment"

The TUI shows the same file icon and "attachment", but there is no real attachment: the TUI footer has no attachment bindings, and hey attachment list correctly reports 0. The actual body text is never shown.

The text in the email's body can be retrieved by running hey thread read --html and pulling the text out of the raw html.

The email I noticed this on has some personally identifying information so I'm not providing it all in this issue, but I am happy to forward the email or provide the raw html to a developer if it would help.

Version: hey 1.10.0

Image

Possible Cause

I'm sorry, I'm not a software developer myself, but after I had Claude Code extract the text in the email for me, it gave me this explanation:

HEY wraps the body twice. hey thread read --html gives this structure (trimmed):

<figure data-trix-attachment='{"contentType":"text/html","content":"<shadow-content><action-text-attachment content-type=\"text/html\" content=\"&lt;p&gt;Hi all, ...&lt;/p&gt;\"></action-text-attachment></shadow-content>"}'>
</figure>

In internal/htmlutil/markdown.go:

  • figure() correctly unpacks the outer Trix attachment via m.embedded(attachment.Content).
  • The inner <action-text-attachment content-type="text/html" content="..."> then goes to actionTextAttachment(), which treats it as a file. It has no filename and the content type is text/, so attachment() writes 📄 + the fallback name attachment.

findAttachments in htmlutil.go already handles this shape (the isHTMLContentType(...) && getAttr(n, "content") != "" case recurses into the content), so the renderer and the attachment finder disagree about the same node.

Suggested fix

In actionTextAttachment(), render an HTML-typed node that carries content as embedded markup, the way figure() does:

func (m *markdownizer) actionTextAttachment(n *html.Node) {
	if isHTMLContentType(getAttr(n, "content-type")) && getAttr(n, "content") != "" {
		m.embedded(getAttr(n, "content"))
		return
	}
	// ...existing handling
}

walkNode in htmlutil.go (the plain-text path) has the same gap in its action-text-attachment case and probably needs the same change.

Workaround

hey thread read <topic_id> --html and strip the tags yourself; the text is all there.

Activity

  1. robzolkos commented on Oct 27, 2026

    @robzolkos
    Contributor

    Thanks for the clear report. This is fixed by #335 and will be included in the next release. We checked the nested email body in both the CLI and TUI against dev HEY.

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions