From 94c45bbc4ef8812210d5da690e12e73281d0ddbf Mon Sep 17 00:00:00 2001 From: Your Name Date: Mon, 29 Dec 2025 01:18:04 +0800 Subject: [PATCH] =?UTF-8?q?fix:=20=E4=BF=AE=E5=A4=8DArrayBuffer=E7=B1=BB?= =?UTF-8?q?=E5=9E=8B=E9=94=99=E8=AF=AF=EF=BC=8C=E4=BD=BF=E7=94=A8Uint8Arra?= =?UTF-8?q?y=E6=9B=BF=E4=BB=A3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/api/enhance/route.ts | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) diff --git a/app/api/enhance/route.ts b/app/api/enhance/route.ts index f2e1355..266f517 100644 --- a/app/api/enhance/route.ts +++ b/app/api/enhance/route.ts @@ -264,16 +264,13 @@ export async function POST(request: NextRequest) { formData.on("error", reject); }); - // 将Buffer转换为ArrayBuffer用于fetch - const arrayBuffer = formDataBuffer.buffer.slice( - formDataBuffer.byteOffset, - formDataBuffer.byteOffset + formDataBuffer.byteLength - ); + // 将Buffer转换为Uint8Array用于fetch(更兼容) + const uint8Array = new Uint8Array(formDataBuffer); response = await fetch(enhanceUrl, { method: "POST", headers, - body: arrayBuffer, + body: uint8Array, signal: controller.signal, });