fix(api): 未改动任何字段的 PATCH 返回空 patched 数组而非 null

This commit is contained in:
Lemon-miaow committed 2026-09-24 17:04:02 +08:00
1 parent 215bfd78d7
commit 0c29ab3a96
2 files changed
+7 -1

No files matched your search

+3 -1
View File
@@ -683,7 +683,9 @@ func (a *API) handlePatchServer(w http.ResponseWriter, r *http.Request) {
// the SAME helpers the create form uses. `changed` records what actually moves
// so the response and audit name the real mutation.
var patch ServerSpecPatch
var changed []string
// Non-nil so a patch that moves nothing (re-picking the image a server is
// already pinned to) still answers "patched": [], as the API documents.
changed := []string{}
// imageFrom is the image a confirmed image change replaced, for the audit row.
var imageFrom string