HTML email nested in a text/html `action-text-attachment` renders as "📄 attachment" instead of its body
维护者通常 1 天内回复
还没有人认领这个 Issue。
评估
调研方向
阅读 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
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=\"<p>Hi all, ...</p>\"></action-text-attachment></shadow-content>"}'>
</figure>
In internal/htmlutil/markdown.go:
figure()correctly unpacks the outer Trix attachment viam.embedded(attachment.Content).- The inner
<action-text-attachment content-type="text/html" content="...">then goes toactionTextAttachment(), which treats it as a file. It has no filename and the content type istext/, soattachment()writes📄+ the fallback nameattachment.
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 模板
- 阅读贡献指南
从这里开始
- 先读完整个 Issue,再读项目的贡献指南。
- 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
- Fork 仓库,在一个分支上完成修改。
- 提交 Pull Request,并在描述里引用这个 Issue 编号。
basecamp/hey-cli 的其他 Issue
-
难度 4/5 3-5 天 新手友好度 48/100
basecamp/hey-cli#607 · 1 条评论 ·
维护者通常 1 天内回复
-
installer-canary
难度 2/5 1-3 小时 新手友好度 48/100
basecamp/hey-cli#601 · 1 条评论 ·
维护者通常 1 天内回复
-
难度 3/5 1-2 天 新手友好度 58/100
维护者通常 1 天内回复
-
难度 4/5 3-5 天 新手友好度 50/100
维护者通常 1 天内回复
-
Timed events show on their UTC day, not their local day, west of UTC可能已有人在做 @armada877 于 19 天前认领。 未关闭
难度 1/5 1 小时以内 新手友好度 10/100
维护者通常 1 天内回复
相似的 Issue
-
Headerless responses block while skipping duplicate status lines可能已有人在做 @mynhe 今天认领。 未关闭
难度 2/5 1-3 小时 新手友好度 73/100
projectdiscovery/rawhttp#554 ·
-
难度 2/5 1-3 小时 新手友好度 80/100
维护者通常 1 天内回复
-
难度 2/5 1-3 小时 新手友好度 82/100
维护者通常 1 天内回复
-
难度 2/5 1-3 小时 新手友好度 85/100
lognorman20/monaco#7428 ·
-
docs(prompts): IF BLOCKED workflow-scope branch says to comment on the issue on jira/local trackers未关闭agent-butler-finding bug
难度 2/5 1-3 小时 新手友好度 77/100
jordansmall/spindrift#6238 ·
维护者通常 1 天内回复