fix: Correctly trim parentheses from detected Linux distribution name in GetDistro method

This commit is contained in:
HynoR 2025-12-03 12:48:00 +08:00
parent 2e56c05c0d
commit 5548651615

View file

@ -43,8 +43,8 @@ func (h *HostInfoState) GetHostInfo(forceRefresh bool) (*host.InfoStat, error) {
func (h *HostInfoState) GetDistro() string {
if h.cachedDistro == "" {
d := detectLinuxDistro()
if strings.HasSuffix(d, "(") {
d = d[:strings.Index(d, "(")]
if strings.Contains(d, "(") && strings.Contains(d, ")") {
d = d[:strings.LastIndex(d, "(")]
}
h.cachedDistro = strings.TrimSpace(d)
}