From de56316efae59dc1bfd517b90bc66611d017a52a Mon Sep 17 00:00:00 2001 From: nsfisis Date: Mon, 20 Jul 2026 06:28:28 +0900 Subject: fix(config): drop insecure git protocol under secure-http Config::get("github-protocols") ported PHP's array_search over the protocol list via a string-keyed map, but array_search_mixed returns the matched index as PhpMixed::Int, which the as_string() read never matched, so the git protocol was never removed (Config.php:447-449 removes it whenever secure-http is on). Search the list directly and read the index as an Int. Un-ignore test_update_throws_runtime_exception_if_git_command_fails which this had blocked. Co-Authored-By: Claude Fable 5 --- crates/shirabe/src/config.rs | 21 +++------------------ 1 file changed, 3 insertions(+), 18 deletions(-) (limited to 'crates/shirabe/src') diff --git a/crates/shirabe/src/config.rs b/crates/shirabe/src/config.rs index 966d6bac..8f78ecca 100644 --- a/crates/shirabe/src/config.rs +++ b/crates/shirabe/src/config.rs @@ -841,29 +841,14 @@ impl Config { .and_then(|v| v.as_bool()) .unwrap_or(false); if secure_http { - let map: IndexMap = protos - .iter() - .enumerate() - .map(|(i, s)| (i.to_string(), s.clone())) - .collect(); let found = array_search_mixed( &PhpMixed::String("git".to_string()), - &PhpMixed::Array( - map.into_iter() - .map(|(k, v)| (k, PhpMixed::String(v))) - .collect(), - ), + &PhpMixed::List(protos.iter().cloned().map(PhpMixed::String).collect()), false, ); if let Some(idx_val) = found { - let idx = idx_val - .as_string() - .unwrap_or("") - .parse::() - .unwrap_or(usize::MAX); - if idx < protos.len() { - protos.remove(idx); - } + let idx = idx_val.as_int().expect("list search index") as usize; + protos.remove(idx); } } let first = protos.first().cloned(); -- cgit v1.3.1