Fix case-insensitive matching for builtin extension names (#6825)

Co-authored-by: Douwe Osinga <douwe@squareup.com>
Co-authored-by: Claude Sonnet 4.5 <noreply@anthropic.com>
This commit is contained in:
Douwe Osinga
2026-01-29 19:54:58 -05:00
committed by GitHub
parent 22e10b14bf
commit 4d100d59a3
4 changed files with 32 additions and 33 deletions
+9 -4
View File
@@ -20,10 +20,15 @@ pub struct ExtensionEntry {
}
pub fn name_to_key(name: &str) -> String {
name.chars()
.filter(|c| !c.is_whitespace())
.collect::<String>()
.to_lowercase()
let mut result = String::with_capacity(name.len());
for c in name.chars() {
result.push(match c {
c if c.is_ascii_alphanumeric() || c == '_' || c == '-' => c,
c if c.is_whitespace() => continue,
_ => '_',
});
}
result.to_lowercase()
}
fn get_extensions_map_with_config(config: &Config) -> IndexMap<String, ExtensionEntry> {