feat(read): return the HTML body from read_email #35
No reviewers
Labels
No labels
waiting-on-julian
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference
jlxq0/jmap-mcp!35
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "feat/read-html-body"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
The sender was the one party unable to check its own output.
v0.2.19gavesend_emailabody_html;Email/getnever asked forhtmlBody.Did the
read_emailhalf rather than theContent-Typehalf, so an agent can also read HTML mail it receives.The acceptance, not "the field exists"
html_composed_by_send_survives_the_read_pathtakesbuild_email_objectoutput, the send path, and feeds it toextract_html_body, the read path, asserting the markup comes back byte-for-byte including astyleattribute and an&in a query string. A JMAPEmailcarries the samebodyValues/textBody/htmlBodyshape both directions, so that output is a faithful stand-in for anEmail/getresult.No fallback, on purpose
extract_text_bodyfalls back to the first available bodyValue and that is harmless there.extract_html_bodymust not: it would return the plain-text part asbody_htmlon a text-only email, so a sender checking whether its markup arrived would be told yes for every message ever sent.Nonemeans no HTML part and stays distinguishable.The HTML is untrusted content
It gets its own suspicion verdict and its flag is OR-ed in, because a payload placed only in the HTML would be invisible to a check that reads the text part. Evaluated separately rather than concatenated:
body_textcarriesverdict.wrapped, so a combined input would have put the markup inside the plain-text field. I caught that before it built. The markup is returned unwrapped, since the sandbox wrap is text delimiters and would stop it being valid HTML, and truncated withtruncate_text_bodyso the byte cap cannot land inside a multibyte char.Mutations, including yours
htmlBody+fetchHTMLBodyValuesfrom the requestthe_request_asks_for_the_html_parthtmlBodyabsent → fall back to any bodyValuea_text_only_email_reads_back_no_htmlextract_html_bodyreadstextBody's partIdbody_html: Nonein the handler's resultYour mutation redded nothing when you first described it, and that is why the request moved into
read_email_get_args. Three tests on the extractor passed withhtmlBodyandfetchHTMLBodyValuesgone from theEmail/get, because none of them reached the request. Same shape as#31, one layer up. It now reds.Two things reported rather than dropped.
body_html: Nonein the handler reds nothing: that is#31's class, the handler assemblingReadEmailResulthas no test that reaches it, and I have not closed it here. And my first attempt at the fallback mutation redded nothing because I placed it after the partId lookup had already succeeded, where nothing dangerous happens; placed on the absent-htmlBodypath it reds. A mis-placed mutation and a test gap read identically.Gate
Toolchain read from
ci.yml:1.93.0. Throughbuild-slot.sh.All
rc=0.Closes #33