fix: 重新上传zip包时自动清空entry_file/entry_files/desktop_shortcut_files

This commit is contained in:
Trae AI
2026-06-21 18:47:38 +08:00
parent 75d38a6972
commit 857e55ca72
+13 -3
View File
@@ -529,6 +529,19 @@ func handleUpdateVersionGlobal(c *gin.Context) {
if req.Version != "" { if req.Version != "" {
updates["version"] = 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 != "" { if req.FilePath != "" {
updates["file_path"] = req.FilePath updates["file_path"] = req.FilePath
} }
@@ -538,9 +551,6 @@ func handleUpdateVersionGlobal(c *gin.Context) {
if req.FileHash != "" { if req.FileHash != "" {
updates["file_hash"] = 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 != "" { if req.UpdateStrategy != "" {
updates["update_strategy"] = req.UpdateStrategy updates["update_strategy"] = req.UpdateStrategy
} }