- let processed_url;
- if !url.starts_with("gemini:") && url.ends_with(".gmi") {
- processed_url = url.replace(".gmi", ".html");
+ let path = Path::new(url);
+ let processed_url = if !url.starts_with("gemini:")
+ && path
+ .extension()
+ .map_or(false, |ext| ext.eq_ignore_ascii_case("gmi"))
+ {
+ url.replace(".gmi", ".html")