From f4afea45601d10ba1ad49c4e51cc42a35542fda6 Mon Sep 17 00:00:00 2001 From: abearxiong Date: Sun, 1 Feb 2026 15:45:49 +0800 Subject: [PATCH] =?UTF-8?q?=E6=9B=B4=E6=96=B0=E7=89=88=E6=9C=AC=E8=87=B3?= =?UTF-8?q?=200.0.38=EF=BC=8C=E4=BF=AE=E5=A4=8D=E6=96=87=E4=BB=B6=E4=B8=8A?= =?UTF-8?q?=E4=BC=A0=E6=97=B6=E7=9A=84=20chunk=20=E5=8F=82=E6=95=B0?= =?UTF-8?q?=E8=AE=BE=E7=BD=AE=EF=BC=8C=E4=BC=98=E5=8C=96=E6=96=87=E4=BB=B6?= =?UTF-8?q?=E5=88=87=E7=89=87=E5=A4=84=E7=90=86?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- package.json | 2 +- query/query-resources/index.ts | 9 ++++++--- 2 files changed, 7 insertions(+), 4 deletions(-) diff --git a/package.json b/package.json index 4bb1906..3946165 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "@kevisual/api", - "version": "0.0.37", + "version": "0.0.38", "description": "", "main": "mod.ts", "scripts": { diff --git a/query/query-resources/index.ts b/query/query-resources/index.ts index b9a1626..c140c6b 100644 --- a/query/query-resources/index.ts +++ b/query/query-resources/index.ts @@ -107,7 +107,7 @@ export class QueryResources { const filename = path.basename(pathname); const url = new URL(pathname, window.location.origin); url.searchParams.set('hash', hash); - url.searchParams.set('chunked', '1'); + url.searchParams.set('chunk', '1'); console.log(`url,`, url, hash); // 预留 eventSource 支持(暂不处理) // const createEventSource = opts?.createEventSource; @@ -118,10 +118,12 @@ export class QueryResources { for (let currentChunk = 0; currentChunk < totalChunks; currentChunk++) { const start = currentChunk * chunkSize; const end = Math.min(start + chunkSize, file.size); - const chunk = file.slice(start, end); + const chunkBlob = file.slice(start, end); + // 转换为 File 类型 + const chunkFile = new File([chunkBlob], filename, { type: file.type || 'application/octet-stream' }); const formData = new FormData(); - formData.append('file', chunk, filename); + formData.append('file', chunkFile, filename); formData.append('chunkIndex', currentChunk.toString()); formData.append('totalChunks', totalChunks.toString()); console.log(`Uploading chunk ${currentChunk + 1}/${totalChunks}`, url.toString()); @@ -136,6 +138,7 @@ export class QueryResources { headers: { ...opts?.headers, ...this.header(opts?.headers, false) }, params: { hash: hash, + chunk: '1', ...opts?.params, }, });