fix: 修复ArrayBuffer类型错误,使用Uint8Array替代
This commit is contained in:
parent
73690e7434
commit
94c45bbc4e
@ -264,16 +264,13 @@ export async function POST(request: NextRequest) {
|
|||||||
formData.on("error", reject);
|
formData.on("error", reject);
|
||||||
});
|
});
|
||||||
|
|
||||||
// 将Buffer转换为ArrayBuffer用于fetch
|
// 将Buffer转换为Uint8Array用于fetch(更兼容)
|
||||||
const arrayBuffer = formDataBuffer.buffer.slice(
|
const uint8Array = new Uint8Array(formDataBuffer);
|
||||||
formDataBuffer.byteOffset,
|
|
||||||
formDataBuffer.byteOffset + formDataBuffer.byteLength
|
|
||||||
);
|
|
||||||
|
|
||||||
response = await fetch(enhanceUrl, {
|
response = await fetch(enhanceUrl, {
|
||||||
method: "POST",
|
method: "POST",
|
||||||
headers,
|
headers,
|
||||||
body: arrayBuffer,
|
body: uint8Array,
|
||||||
signal: controller.signal,
|
signal: controller.signal,
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user