Repository navigation
Conversation
|
No actionable comments were generated in the recent review. Walkthrough
Merge Risk:
|
There was a problem hiding this comment.
AI-generated review (Claude Opus 5.5). Not a maintainer decision.
No blocking problems found (not certain).
Strips one leading UTF-8 BOM before RTF sniffing and before outline paragraph parsing, and adds a regression test covering detection and outline text.
- crates/format/src/rtf.rs:63 strips the BOM bytes with strip_prefix before calling the shared sniffer; no panic path.
- crates/format/src/rtf.rs:192 strips U+FEFF from the decoded text before paragraph parsing, so the mark no longer ends up in the first title.
- crates/format/src/rtf.rs:633-638: the test places a space and CRLF after the BOM. A case with the BOM directly before {\rtf1 would cover the plain form as well.
- This relies on the input being decoded as UTF-8 before paragraphs() runs; a non-UTF-8 decode would leave the BOM as three Latin-1 characters.
Claims checked:
- verified: The RTF sniffer now accepts input that starts with a UTF-8 BOM. (crates/format/src/rtf.rs:63 calls craft_rtf::is_rtf(bytes.strip_prefix(b"\xef\xbb\xbf").unwrap_or(bytes)); test at crates/format/src/rtf.rs:636 asserts sniff_rtf on BOM-prefixed input.)
- verified: The outline parser no longer treats the BOM as part of the first title. (crates/format/src/rtf.rs:192 strips a leading '\u{feff}' in paragraphs(); crates/format/src/rtf.rs:637 asserts rtf_to_outline yields "Document\n\tCafé\n".)
- unverified: Both import routes (open and insert) get the fix at the import boundary. (The fix sits inside sniff_rtf (crates/format/src/rtf.rs:63) and paragraphs (crates/format/src/rtf.rs:192), not at a caller boundary. The open and insert callers could not be read to confirm they both go through these function…
- verified: Both routes still use the pinned shared lexer. (crates/format/src/rtf.rs:63 still delegates to craft_rtf::is_rtf; no Cargo.toml or lockfile change in the PR.)
Reviewed at 18d7537.
Recommendation: merge, after a maintainer's decision.
DeckCraft can open and insert UTF-8 RTF outlines that start with a byte order mark.
The shared RTF sniffer rejected the leading mark, and the outline parser could treat the mark as part of the first title. Drop one leading BOM at the import boundary before sniffing and paragraph parsing. Both import routes still use the pinned shared lexer.
The regression checks detection and the resulting outline text. The focused Rust harness reproduced both failures and passed 11 tests with the fix, including the pinned lexer tests. It used the current importer and a presentation test double. Full crate checks were left to CI.
Summary by CodeRabbit