List the files inside an embedded text/html attachment - #346
Open
adammiribyan wants to merge 1 commit into
Open
Conversation
An HTML email from outside HEY arrives as one <figure data-trix-attachment> with contentType "text/html" and the original markup in its content string (21751f9). When that email carried files -- an Outlook sender attaching two PDFs, say -- they sit inside that markup as <action-text-attachment> elements, so `hey attachment list` answered "0 attachments" for a thread whose `hey thread read` plainly showed the 📎 lines, and `hey attachment save` had nothing to address. findAttachments now walks into the embedded markup the way findImages already does, bounded by embeddedContentDepthLimit, and lists what it finds there. The wrapper itself is still not listed: an embedded body is not a downloadable file, and the test that says so still holds.
Contributor
There was a problem hiding this comment.
Pull request overview
Enables attachment discovery within embedded HTML email bodies while preserving wrapper exclusion and bounded recursion.
Changes:
- Recursively extracts nested downloadable attachments.
- Adds extraction and recursion-limit tests.
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.
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated no comments.
| File | Description |
|---|---|
internal/htmlutil/htmlutil.go |
Traverses embedded HTML when extracting attachments. |
internal/htmlutil/htmlutil_test.go |
Tests nested extraction and depth limiting. |
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
hey attachment listreturns 0 attachments for an inbound HTML email (Outlook and the like) even whenhey thread readshows the 📎 lines, sohey attachment savehas no ID to work with.Why: since 21751f9 such an email is one
text/htmltrix<figure>whosecontentstring holds the original markup.findAttachmentsstops at that figure; the<action-text-attachment>file elements are inside the markup.Fix:
findAttachmentsrecurses into the embedded markup the same wayfindImagesalready does, with the sameembeddedContentDepthLimit. The wrapper itself is still not listed (TestExtractAttachmentsSkipsEmbeddedHTMLAttachmentis unchanged).Review: one
switchinfindAttachmentsmirroring the one infindImages, plus two tests — the first fails onmain, the second pins the depth limit.make checkpasses.