daemon: fix UTF-8 panics on multi-byte character truncation
&str[..n] panics when n falls inside a multi-byte UTF-8 sequence. This crashed the daemon when processing IRC messages containing Hebrew/Yiddish characters (ehashman's messages hit byte 79-81). Replace all byte-index truncation with chars().take(n).collect() in tmux send_prompt preview, notification logging, and git context truncation. Co-Authored-By: ProofOfConcept <poc@bcachefs.org>
This commit is contained in:
parent
308fbe4c28
commit
bea1bd5680
3 changed files with 4 additions and 3 deletions
|
|
@ -169,7 +169,7 @@ impl NotifyState {
|
|||
|
||||
info!(
|
||||
"notification: type={ntype} urgency={urgency} threshold={threshold} msg={}",
|
||||
&message[..message.len().min(80)]
|
||||
message.chars().take(80).collect::<String>()
|
||||
);
|
||||
|
||||
self.pending.push(Notification {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue