From f0559617145a0fba45d347f4de8e5e834f67c4d3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E7=8E=8B=E5=BE=B7=E5=AE=87?= Date: Sat, 12 Sep 2026 14:55:35 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E6=AD=A3=E5=88=86=E7=A6=BB=E6=BA=90?= =?UTF-8?q?=E5=9B=BE=20MIME=20=E8=AF=86=E5=88=AB=E5=9B=9E=E9=80=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 缺失或未知 MIME 时强制走 PNG 规范化,避免非 PNG 数据被误标为 image/png。 --- .../src/ui_editor/commands/separation/workflow/extract.rs | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/apps/ai-game-creator-shell/src-tauri/src/ui_editor/commands/separation/workflow/extract.rs b/apps/ai-game-creator-shell/src-tauri/src/ui_editor/commands/separation/workflow/extract.rs index b359fb32e..f55db59e3 100644 --- a/apps/ai-game-creator-shell/src-tauri/src/ui_editor/commands/separation/workflow/extract.rs +++ b/apps/ai-game-creator-shell/src-tauri/src/ui_editor/commands/separation/workflow/extract.rs @@ -52,9 +52,8 @@ async fn raw_extract_inner( .ok_or_else(|| "界面图 data URL 无效".to_string())?; let mime = mime .strip_prefix("data:") - .and_then(|value| value.strip_suffix(";base64")) - .unwrap_or("image/png"); - let is_png = mime.eq_ignore_ascii_case("image/png"); + .and_then(|value| value.strip_suffix(";base64")); + let is_png = mime.is_some_and(|value| value.eq_ignore_ascii_case("image/png")); let image_bytes = base64::engine::general_purpose::STANDARD .decode(data.trim()) .map_err(|error| format!("解码源图失败:{error}"))?;