storkit: merge 437_bug_strip_prefix_ci_panics_on_multi_byte_utf_8_input

This commit is contained in:
dave
2026-03-28 16:30:44 +00:00
parent 77ff0ce093
commit 08db28d9d6
8 changed files with 28 additions and 32 deletions
+2 -4
View File
@@ -74,10 +74,8 @@ fn strip_mention<'a>(message: &'a str, bot_name: &str, bot_user_id: &str) -> &'a
}
fn strip_prefix_ci<'a>(text: &'a str, prefix: &str) -> Option<&'a str> {
if text.len() < prefix.len() {
return None;
}
if !text[..prefix.len()].eq_ignore_ascii_case(prefix) {
let candidate = text.get(..prefix.len())?;
if !candidate.eq_ignore_ascii_case(prefix) {
return None;
}
let rest = &text[prefix.len()..];