fix: 解决获取版本升级信息失败的问题 (#4914)

This commit is contained in:
ssongliu 2024-05-08 14:32:23 +08:00 committed by GitHub
parent 34eb20a679
commit 75c23271df
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -42,10 +42,19 @@ func (u *UpgradeService) SearchUpgrade() (*dto.UpgradeInfo, error) {
}
upgrade.TestVersion, upgrade.NewVersion, upgrade.LatestVersion = u.loadVersionByMode(DeveloperMode.Value, currentVersion.Value)
itemVersion := upgrade.LatestVersion
if upgrade.NewVersion != "" {
var itemVersion string
if len(upgrade.LatestVersion) != 0 {
itemVersion = upgrade.LatestVersion
}
if len(upgrade.NewVersion) != 0 {
itemVersion = upgrade.NewVersion
}
if (global.CONF.System.Mode == "dev" || DeveloperMode.Value == "enable") && len(upgrade.TestVersion) != 0 {
itemVersion = upgrade.TestVersion
}
if len(itemVersion) == 0 {
return &upgrade, nil
}
notes, err := u.loadReleaseNotes(fmt.Sprintf("%s/%s/%s/release/1panel-%s-release-notes", global.CONF.System.RepoUrl, global.CONF.System.Mode, itemVersion, itemVersion))
if err != nil {
return nil, fmt.Errorf("load releases-notes of version %s failed, err: %v", itemVersion, err)