Repository navigation
fix(gmail): forward the HTML body as text when the original has no plain part - #1321
saariuslystoned wants to merge 2 commits into
Conversation
…ain part gmail forward and gmail drafts forward copied the original's text/plain body into the forward's plain part. An HTML-only original, or one with a whitespace-only plain part, left that part with the forwarded headers and no body. Convert the HTML to text, as the reply quote already does. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
|
🦞👀 Pull request received. I will update this pull request when review starts. ClawSweeper review completeClawSweeper finished reviewing this revision. The review result is being finalized. |
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
|
Codex review: needs maintainer review before merge. What this changesThis PR converts an original message’s HTML to text when forwarding a message with no usable plain-text body. Example: Forward an HTML-only message containing <p>Quarterly <b>numbers</b> attached.</p> to carol@example.com.
Review scores
ProductKind: Bug fix · Worth it: Yes · Fix scope: Complete Merge readiness✅ Ready for maintainer review Keep this PR: current main still produces headers-only plain alternatives for HTML-only originals, and this focused fix introduces no actionable defect. Priority: P2 Before mergeNone. FindingsNone. Agent review detailsHow this fits togetherGmail send-forward and draft-forward share a composition builder that fetches the original message, constructs MIME alternatives and attachments, and passes the result to Gmail’s send or draft endpoint. flowchart TD
A[Forward CLI] --> C[Shared forward builder]
B[Draft forward CLI] --> C
D[Original Gmail message] --> C
C --> E[Existing HTML to text converter]
E --> F[Outgoing MIME alternatives]
C --> F
F --> G[Gmail send or draft endpoint]
Technical reviewBest possible solution: Land the fallback in the existing shared forward builder so both sending and drafting preserve readable original text. Do we have a high-confidence way to reproduce the issue? Current-main source deterministically builds a headers-only plain alternative for an HTML-only original; the contributor also records before/after CLI output, but no target code was run during this read-only review. Is this the best way to solve the issue? The patch addresses the missing conversion at the shared forward owner and reuses reply’s converter without adding flags, dependencies, or a parallel composition path. AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning medium; reviewed against e8428c36dd31. Provenance checked
TestingProof path: shipped entry point. SecurityNone. EvidenceWhat I checked:
Likely related people:
Preflight sourceSource unknown. Source comparison at the observed PR snapshot only. Completion is self-reported; body, policy, tests, execution, and report bytes are not verified. Review metrics
LabelsLabel changes:
Label justifications:
Rating scale6/6 🦀 challenger crab · 5/6 🦞 diamond lobster · 4/6 🐚 platinum hermit · 3/6 🦐 gold shrimp · 2/6 🦪 silver shellfish · 1/6 🧂 unranked krab. Overall follows the weaker of proof and patch quality; ✨ marks media proof (a screenshot, video, or linked artifact) that directly shows the changed behavior. WorkflowClawSweeper edits this one comment on every review. Comment Reviewed November 8, 2026, 3:23 PM ET / 20:23 UTC. |
|
Thank you for the fix. I reproduced the claim and consolidated including an HTML-only original in the plain-text forwarded body into #1336, with regression coverage and your coauthor credit retained. The full |
What problem this solves
gmail forwardandgmail drafts forwardbuild the forward's plain-text part from the original'stext/plainbody. When the original has no plain-text part (an HTML-only message), or a blank one, the plain part holds only the "Forwarded message" headers and no body:The HTML part is correct. Anyone whose client shows the plain alternative, or a script that reads it, sees an empty forward. Reply already handles this case:
applyQuoteToBodiesconverts the HTML withhtmlToPlainTextwhen the original's plain body is blank.Change
When the original's plain body is empty or whitespace-only and it has an HTML body, the forward converts that HTML with the existing
htmlToPlainTextand uses the result as the forwarded plain body. Originals with a usable plain part are unchanged, and so is the HTML part.Evidence
TestGmailForward_PlainPartCarriesHTMLOnlyOriginalrunsgmail forwardandgmail drafts forwardthrough the CLI entry point against the existing forward test server, for an HTML-only original and for one whose plain part is" \r\n". Onmain(e8428c3) all four cases fail with the headers-only plain part shown above. With this change the plain part containsQuarterly numbers attached.with no markup, and the HTML part still carries the original HTML. The existing forward, reply, quote and drafts tests pass.Built
gogbinaries frommainand from this branch were run against a local Gmail stand-in throughGOG_GOOGLE_API_BASE_URL(not Google) that decodes eachmessages.sendbody:Every
make cistep passed on1c12bd7(go1.27.3). The Go test suite (go test -count=1 ./...) ran on a second macOS arm64 machine, and the fmt, lint, deadcode, docs, agent-skills and node checks ran locally.No live mailbox was used and no message was sent.
🤖 Generated with Claude Code