Hacktoberfest 2026:维护者为十月标记出来的 issue,仍然开放、适合新手。 浏览 Hacktoberfest issue

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

已关闭 适合新手
#603 0 条评论 0 个 reaction 已指派 0 人 在 GitHub 查看

维护者通常 1 天内回复

还没有人认领这个 Issue。

评估

难度
2/5
预计耗时
1-3 小时
新手友好度
78/100
Issue 类型
缺陷
描述清晰度
描述清楚
活跃度
活跃
技术栈
go, html
领域
cli

调研方向

阅读 internal/htmlutil/markdown.go 和 htmlutil.go,重点查看 actionTextAttachment() 以及 walkNode 中的 action-text-attachment 分支;将它们与 figure() 和 findAttachments 中现有的 HTML 内容处理进行比较。使用提供的嵌套 text/html 示例复现问题。当渲染后的 Markdown 和纯文本都显示嵌入的邮件正文,而不是附件占位符时,即为完成。

由索引模型根据 Issue 内容生成。

描述

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.

主要语言
Go
星标
420
派生
54
平均合并
1 天 3 小时
30 天内合并 PR
43

环境准备

  • 没有 Dockerfile 或 Docker Compose 文件
  • 没有 Pull Request 模板
  • 阅读贡献指南

从这里开始

  1. 先读完整个 Issue,再读项目的贡献指南。
  2. 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
  3. Fork 仓库,在一个分支上完成修改。
  4. 提交 Pull Request,并在描述里引用这个 Issue 编号。

basecamp/hey-cli 的其他 Issue

查看 basecamp/hey-cli 的全部 Issue

相似的 Issue

更多 Go Issue

把新 issue 发到你的邮箱

精选适合新手参与的 GitHub issue 摘要。