Repository navigation
Conversation
…Labs#2166) Stage 1, part 1 of the attachment-content search: a bounded, panic-free reader for OOXML containers (ECMA-376/APPNOTE: end of central directory, central directory, local headers; stored and deflate members) and the main parts of DOCX/XLSX/PPTX, with XML character data resolved through quick-xml; plain-text formats decode through mailcraft-charset. Caps on input, members, decompressed bytes and kept text; a hostile file is an error, never a stop. Fuzz target included. No PDF (stage 2), no index wiring yet (part 2).
|
Important Draft PR not reviewedDraft PRs are not automatically reviewed by default.
To automatically review draft PRs, update your CodeRabbit configuration: reviews:
auto_review:
drafts: true
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. |
guess decodes (UTF-8, else Windows-1252) and is used as such; the text cap counts characters; a document without its main part is refused; only block ends (p, tr, tc, si, row) separate words, so a run Word splits mid-word stays one; CDATA is read; an end-of-central-directory candidate is believed only when what it says holds; every offset computation is checked; the module's contract says what a malformed document part yields. Five tests cover the new behaviour.
Stage 1, part 2: a new part ATTACHMENT_TEXT next to the attachment's name; texts_full carries the extracted texts (texts and texts_with are unchanged for their callers); attachment: finds names and, where extracted, content. fingerprint_full adds the extraction's version and each attachment's content to the fingerprint when the switch is on, so exactly the messages with attachments are read again when it changes; without attachments the fingerprint is the base one. The budgeted in-step read leaves messages with attachments to the background, as it does hidden words kept on disk; the background extracts within attext's caps. Words::set_attext is the switch; the option and its backfill follow in part 3.
d791dd3 to
837f716
Compare
One step left: sign the Contributor Licence AgreementThank you for contributing. Before this can be merged, everyone listed below signs the CLA once. It takes one comment, and it covers every contribution you make from now on. To sign: add a new comment to this pull request with only this line in it (the copy button is on the right): This check turns green within a minute or so. Editing an older comment doesn't count, so please post a new one. Still to sign: You keep the copyright in your work, and MailCraft stays MIT OR Apache-2.0. The CLA also lets UCS Care Group release MailCraft under other terms, such as a commercial edition, without asking each contributor again. Questions are welcome here. |
|



Builds on #2394. Part 2 of 3 for #2166.
Wires
attextinto the words index, behind a switch that stays off until part 3 adds the option.ATTACHMENT_TEXT = 64besideATTACHMENT(the name).texts_fullis the full list of what search reads, attachment texts as pieces of their own;textsandtexts_withkeep their signatures and delegate with none, so no existing caller changes.ALLgains the part: the plain search box finds attachment text, as announced in the issue.attachment:now limits to names and, where extracted, content — easy to split into a keyword of its own if you'd rather.fingerprint_full(m, attext)is the base fingerprint plus, for a message with attachments and the switch on, the extraction's version (ATTEXT_VERSION) and each attachment's content by its SHA-256 (in memory or kept). Switching the option therefore reads exactly the messages with attachments again; everything else keeps its fingerprint.ATTEXT_VERSIONis the knob for "the extractor changed, read again".attext's caps (attexts_of: bytes from memory or the blobs folder throughstore::Reader; empty texts dropped). The budgeted in-step read leaves messages with attachments to the background while the switch is on, exactly as it already leaves messages whose hidden words are kept on disk.Words::set_attext(bool)is the switch; part 3 connects it to the option and schedules the pass.records_that_lie_are_not_believedused mask64as "a part that doesn't exist"; that part exists now, so the lying mask is128, and a positive assertion checks that64is believed.Tests:
cargo test -p mailcraft-model words(34) and-p mailcraft-engine words(48) pass, including a new one for the part and the fingerprint semantics.fmtandclippyclean.