mirror of
https://github.com/qingchencloud/clawpanel.git
synced 2026-05-06 20:02:49 +08:00
fix: 全局修复 openclaw --version 解析(取数字开头词而非 last/pop)
- config.rs get_local_version CLI fallback: split_whitespace().last() → find(数字开头) - dev-api.js getLocalOpenclawVersion: split().pop() → find(/^\d/) - 同一个 bug 导致版本号被解析为 commit hash,影响版本比较和微信插件兼容检测
This commit is contained in:
@@ -515,7 +515,7 @@ function getLocalOpenclawVersion() {
|
||||
} catch {}
|
||||
}
|
||||
if (!current) {
|
||||
try { current = execSync('openclaw --version 2>&1', { windowsHide: true }).toString().trim().split(/\s+/).pop() } catch {}
|
||||
try { current = execSync('openclaw --version 2>&1', { windowsHide: true }).toString().trim().split(/\s+/).find(w => /^\d/.test(w)) || null } catch {}
|
||||
}
|
||||
return current || null
|
||||
}
|
||||
|
||||
@@ -1276,9 +1276,9 @@ async fn get_local_version() -> Option<String> {
|
||||
.await
|
||||
.ok()?;
|
||||
let raw = String::from_utf8_lossy(&output.stdout).trim().to_string();
|
||||
// 输出格式: "OpenClaw 2026.3.24 (hash)" → 取第一个数字开头的词(版本号)
|
||||
raw.split_whitespace()
|
||||
.last()
|
||||
.filter(|s| !s.is_empty())
|
||||
.find(|w| w.chars().next().map_or(false, |c| c.is_ascii_digit()))
|
||||
.map(String::from)
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user