From a0428da5d183608661af8228633ef563f9b00ffd Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E7=8E=8B=E5=BE=B7=E5=AE=87?= Date: Fri, 2 Oct 2026 22:08:53 +0800 Subject: [PATCH] =?UTF-8?q?HTTP=20=E9=94=99=E8=AF=AF=E5=85=9C=E5=BA=95?= =?UTF-8?q?=E5=85=88=E8=BF=87=E6=BB=A4=20message=20=E5=86=8D=E9=80=80=20co?= =?UTF-8?q?de=EF=BC=8C=E9=81=BF=E5=85=8D=E7=A9=BA=20message=20=E5=90=9E?= =?UTF-8?q?=E6=8E=89=20code?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit game_distribution_publish response_data 的 message.or(code).filter 顺序反了,空 message 会连 code 一起丢掉 map_http_error 同类顺序问题一并修正(review 未列,属同一类 bug) --- .../src-tauri/src/game_distribution_publish.rs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/apps/ai-game-creator-shell/src-tauri/src/game_distribution_publish.rs b/apps/ai-game-creator-shell/src-tauri/src/game_distribution_publish.rs index c3b2aabf9..b4bf84b03 100644 --- a/apps/ai-game-creator-shell/src-tauri/src/game_distribution_publish.rs +++ b/apps/ai-game-creator-shell/src-tauri/src/game_distribution_publish.rs @@ -195,8 +195,8 @@ fn response_data(body: &str) -> Result { if value.get("ok").and_then(Value::as_bool) == Some(false) { let (code, message) = parse_error_payload(body); return Err(message - .or(code) .filter(|detail| !detail.trim().is_empty()) + .or_else(|| code.filter(|detail| !detail.trim().is_empty())) .unwrap_or_else(|| "服务器未返回错误信息".to_string())); } Ok(value.get("data").cloned().unwrap_or(value)) @@ -215,8 +215,8 @@ fn map_http_error(status: StatusCode, body: &str, fallback: &str) -> String { ); } let detail = message - .or(code) .filter(|value| !value.trim().is_empty()) + .or_else(|| code.filter(|value| !value.trim().is_empty())) .unwrap_or_else(|| format!("HTTP {}", status.as_u16())); format!("{fallback}:{detail}") }