fix: 微信插件版本检测解析修复(取数字开头的词而非最后一个词)

openclaw --version 输出 "OpenClaw 2026.3.24 (hash)",之前用 last() 取到 "(hash)"
导致版本号解析为空,误判为旧版。改为 find() 取第一个数字开头的词。
This commit is contained in:
晴天
2026-03-26 05:26:53 +08:00
parent 2b13bb1130
commit 6df7f49190

View File

@@ -1189,7 +1189,10 @@ pub async fn run_channel_action(
.output()
.ok()?;
let raw = String::from_utf8_lossy(&out.stdout).trim().to_string();
raw.split_whitespace().last().map(String::from)
// 输出格式: "OpenClaw 2026.3.24 (hash)" → 取第二个词(版本号)
raw.split_whitespace()
.find(|w| w.chars().next().map_or(false, |c| c.is_ascii_digit()))
.map(String::from)
})
.unwrap_or_default();
let oc_nums: Vec<u32> = oc_ver