From 293879b2118687a4ad1d7fef15fe4a6a5c9a15ce Mon Sep 17 00:00:00 2001 From: afterlifepro Date: Sat, 18 Oct 2025 23:16:15 +0100 Subject: [PATCH] upload: fix edge case for /index.html tldr: the key mapper stripped /index.html, to ensure the entire segment was an index.html at the end and to avoid conflict because the root of the site wasnt prefixed with a / before mapping, a path of index.html would just get mapped to path /index.html instead of / fix: add special case for index.html also make it a map bc more special cases may be added --- upload/Cargo.lock | 2 +- upload/Cargo.toml | 2 +- upload/src/main.rs | 8 ++++---- 3 files changed, 6 insertions(+), 6 deletions(-) diff --git a/upload/Cargo.lock b/upload/Cargo.lock index 18a84ad..a76de2e 100644 --- a/upload/Cargo.lock +++ b/upload/Cargo.lock @@ -163,7 +163,7 @@ dependencies = [ [[package]] name = "atcities-upload" -version = "1.0.0" +version = "1.0.1" dependencies = [ "clap", "env_logger", diff --git a/upload/Cargo.toml b/upload/Cargo.toml index 18e695f..5a21948 100644 --- a/upload/Cargo.toml +++ b/upload/Cargo.toml @@ -4,7 +4,7 @@ members = ["lexicons"] [package] name = "atcities-upload" -version = "1.0.0" +version = "1.0.1" edition = "2024" [dependencies] diff --git a/upload/src/main.rs b/upload/src/main.rs index fbec99c..f64a45c 100644 --- a/upload/src/main.rs +++ b/upload/src/main.rs @@ -179,10 +179,10 @@ async fn update_remote_site( let mut create_records = new_sitemap .into_iter() .map(|(k, v)| { - let k = if k == "404.html" { - String::from("404") - } else { - match k.strip_suffix("/index.html") { + let k = match k.as_str() { + "404.html" => String::from("404"), + "index.html" => String::from("/"), + _ => match k.strip_suffix("/index.html") { Some(k) => format!("/{k}/"), None => format!("/{k}"), } -- 2.51.2