From 2507dc8f025252ed67f33dce207ce38b18c09ca7 Mon Sep 17 00:00:00 2001 From: openclaw Date: Mon, 20 Apr 2026 13:32:24 +0800 Subject: [PATCH] =?UTF-8?q?fix(pve):=20Password=E5=AD=97=E6=AE=B5JSON=20ta?= =?UTF-8?q?g=E4=B8=BA-=E5=AF=BC=E8=87=B4=E5=89=8D=E7=AB=AF=E5=AF=86?= =?UTF-8?q?=E7=A0=81=E6=97=A0=E6=B3=95=E4=BC=A0=E5=85=A5?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - models.go: PVEHost.Password json tag "-" -> "password", 否则c.ShouldBindJSON无法绑定前端传的password字段 - handlers/pve.go: 返回前清空Password字段防止泄露 [金渐层/K2.6-code-preview🐾] --- server/handlers/pve.go | 2 ++ server/models/models.go | 2 +- 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/server/handlers/pve.go b/server/handlers/pve.go index 1d79e6d..7e1fc68 100644 --- a/server/handlers/pve.go +++ b/server/handlers/pve.go @@ -67,6 +67,7 @@ func (h *PVEHandler) Get(c *gin.Context) { } host.PasswordEnc = "" + host.Password = "" c.JSON(http.StatusOK, host) } @@ -98,6 +99,7 @@ func (h *PVEHandler) Create(c *gin.Context) { } host.PasswordEnc = "" + host.Password = "" c.JSON(http.StatusCreated, host) } diff --git a/server/models/models.go b/server/models/models.go index 047f28c..e6b731a 100644 --- a/server/models/models.go +++ b/server/models/models.go @@ -142,7 +142,7 @@ type PVEHost struct { CreatedAt time.Time `json:"created_at"` UpdatedAt time.Time `json:"updated_at"` // 运行时使用,不存储 - Password string `json:"-"` + Password string `json:"password"` } type PVEVMStatus struct {