From a9805f70f9f5da784541dd5cbd122b90f142697c Mon Sep 17 00:00:00 2001 From: lanrtop Date: Fri, 3 Jul 2026 09:45:01 +0900 Subject: [PATCH] =?UTF-8?q?fix(gitea):=20giteaUpdateInstance=20=E5=8F=82?= =?UTF-8?q?=E6=95=B0=E5=91=BD=E5=90=8D=E4=B8=8D=E5=8C=B9=E9=85=8D=E2=80=94?= =?UTF-8?q?=E2=80=94=E6=9B=B4=E6=96=B0=E9=9D=99=E9=BB=98=E5=A4=B1=E6=95=88?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 前端展开 snake_case 字段(access_token),Tauri 命令层按 camelCase (accessToken)匹配,参数被静默丢弃,后端视为未提供而跳过更新且返回 成功——UI 显示"已更新"但 DB 未变(改 Token 实测 401 暴露)。 显式映射为 camelCase 修复。 Rules-Applied: R08, R10 --- src/lib/commands.ts | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/src/lib/commands.ts b/src/lib/commands.ts index 90e8c50..3fa4369 100644 --- a/src/lib/commands.ts +++ b/src/lib/commands.ts @@ -1655,7 +1655,14 @@ export const giteaDeleteInstance = (id: string) => export const giteaUpdateInstance = ( id: string, fields: { name?: string; url?: string; access_token?: string; is_default?: boolean } -) => invoke("gitea_update_instance", { id, ...fields }); + // Tauri 命令参数按 camelCase 匹配 Rust snake_case,直接展开 snake_case 字段会被静默丢弃 +) => invoke("gitea_update_instance", { + id, + name: fields.name, + url: fields.url, + accessToken: fields.access_token, + isDefault: fields.is_default, +}); export const giteaTestConnection = (instanceId: string) => invoke("gitea_test_connection", { instanceId });