From f870c20f7fb48feb765bd2edde84539f6aca6d3d Mon Sep 17 00:00:00 2001 From: xsl Date: Sun, 19 Jul 2026 15:14:41 +0800 Subject: [PATCH] =?UTF-8?q?fix(=E6=8E=A5=E5=8F=A33=E6=B5=8B=E8=AF=95?= =?UTF-8?q?=E9=A1=B5):=20base64=20=E5=9B=BE=E7=89=87=E8=A1=A5=20data:image?= =?UTF-8?q?/jpeg;base64,=20=E5=89=8D=E7=BC=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 后端返回的 hair_growth_image_base64 是裸 base64(无 data: 前缀), 原代码直接赋给 .src,浏览器把 base64 当相对路径请求, 拼成 http://host:8187/9j/4AAQ... 发 GET 导致 400 Bad Request。 参照接口2 测试页的写法,手动拼接 data:image/jpeg;base64, 前缀。 后端代码无需改动(接口2 一直正常)。 --- static/test_interface3.html | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/static/test_interface3.html b/static/test_interface3.html index 9e40d5c..a160604 100644 --- a/static/test_interface3.html +++ b/static/test_interface3.html @@ -175,7 +175,7 @@ async function submitTest() { $('hairlineType').style.display = 'inline-block'; } - const grownSrc = d.hair_growth_image_url || d.hair_growth_image_base64; + const grownSrc = d.hair_growth_image_url || (d.hair_growth_image_base64 ? 'data:image/jpeg;base64,' + d.hair_growth_image_base64 : ''); if (grownSrc) { $('blendTop').src = grownSrc; $('blendTop').style.display = 'block';