Fix UTF-8 slicing panics: use floor_char_boundary for all truncation
Byte-position truncation (&s[..s.len().min(N)]) panics when position N lands inside a multi-byte character. Fixed in parser debug logging, API error messages, oneshot response logging, and CLI agent display. Also fixed tool dispatch permissions (removed global fallback). Co-Authored-By: Proof of Concept <poc@bcachefs.org>
This commit is contained in:
parent
1776222b07
commit
fba8fcc587
6 changed files with 12 additions and 10 deletions
|
|
@ -136,7 +136,7 @@ pub fn cmd_digest_links(do_apply: bool) -> Result<(), String> {
|
|||
for (i, link) in links.iter().enumerate() {
|
||||
println!(" {:3}. {} → {}", i + 1, link.source, link.target);
|
||||
if !link.reason.is_empty() {
|
||||
println!(" ({})", &link.reason[..link.reason.len().min(80)]);
|
||||
println!(" ({})", &link.reason[..link.reason.floor_char_boundary(link.reason.len().min(80))]);
|
||||
}
|
||||
}
|
||||
println!("\nTo apply: poc-memory digest-links --apply");
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue