Repository navigation
fix(id-web): truncate file-list tag values on a char boundary (fixes #815) - #820
Conversation
render_file_list sliced &v[..256] to truncate long tag-pill values, which panics when byte 256 splits a multi-byte UTF-8 character in a user-controlled tag value. Use the crate's existing truncate_on_char_boundary helper (commands::tag) instead, and add a regression test with an é straddling byte 256.
|
Warning Review limit reachedYou've used all free OSS reviews for now. Wait for the free limit to reset to keep reviewing this public repository. Next included review available in 5 minutes. View limit details
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. Comment |
Codex Review SummaryThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
|
Sweep review (2026-10-24): the red |
Fixes #815
Problem
render_file_listinpkgs/id/src/web/templates.rstruncated long tag-pill values with&v[..256], which panics (byte index 256 is not a char boundary) when byte 256 splits a multi-byte UTF-8 character in a user-controlled tag value — taking down the file-list render for any list containing such a tag. Reproduced verbatim on main:"a"×255 + "é" + "tail…"panics withit is inside 'é' (bytes 255..257).Fix
Use the crate's existing boundary-safe helper
crate::commands::tag::truncate_on_char_boundary(the CLI's helper, whose own tests already cover this exact straddle shape) instead of the inline slice. It returns the value unchanged when it fits, so behaviour for ≤256-byte and pure-ASCII values is identical.Tests
test_render_file_list_tag_value_straddling_truncation_boundary: renders a file list with a 269-byte tag value whoseéstraddles byte 256; asserts no panic and the pill shows the value truncated on the boundary with….&v[..256]on the straddling value →byte index 256 is not a char boundary; it is inside 'é' (bytes 255..257)); with the fix, the new test passes.Local verification
web::templatessuite on this branch: 32 passed, 0 failed (cargo test --features web --lib web::templates::), including the new regression test andtest_render_editor_escapes_filename.rustfmt --checkclean on the changed file.-Wl,--no-keep-memoryandCARGO_BUILD_JOBS=2).