storkit: merge 437_bug_strip_prefix_ci_panics_on_multi_byte_utf_8_input
This commit is contained in:
@@ -136,10 +136,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()..];
|
||||
|
||||
Reference in New Issue
Block a user