diff --git a/backend/internal/router/admin/versions.go b/backend/internal/router/admin/versions.go index 083fe45..63549be 100644 --- a/backend/internal/router/admin/versions.go +++ b/backend/internal/router/admin/versions.go @@ -529,6 +529,19 @@ func handleUpdateVersionGlobal(c *gin.Context) { if req.Version != "" { updates["version"] = req.Version } + + // 当文件路径变化时(重新上传了新包),清空快捷方式和启动文件字段 + // 因为新包的文件列表可能和旧包不同,旧的选择可能不再有效 + if req.FilePath != "" && req.FilePath != version.FilePath { + updates["entry_file"] = "" + updates["entry_files"] = "" + updates["desktop_shortcut_files"] = "" + } else { + updates["entry_file"] = req.EntryFile + updates["entry_files"] = req.EntryFiles + updates["desktop_shortcut_files"] = req.DesktopShortcutFiles + } + if req.FilePath != "" { updates["file_path"] = req.FilePath } @@ -538,9 +551,6 @@ func handleUpdateVersionGlobal(c *gin.Context) { if req.FileHash != "" { updates["file_hash"] = req.FileHash } - updates["entry_file"] = req.EntryFile - updates["entry_files"] = req.EntryFiles - updates["desktop_shortcut_files"] = req.DesktopShortcutFiles if req.UpdateStrategy != "" { updates["update_strategy"] = req.UpdateStrategy }