🐛 fix(upload): 小文件分片不超过实际文件大小
This commit is contained in:
1 parent
f2461378ef
commit
a962f7aec7
2 files changed
+7
-1
No files matched your search
@@ -22,3 +22,9 @@ test('manual retry after lost completion response reuses upload id and never ret
|
||||
assert.equal(result.detail.code,'ORIGINAL');assert.equal(inits,1);assert.equal(chunks,1);assert.equal(completions,5)
|
||||
}finally{service.initChunkUpload=originals.init;service.uploadChunk=originals.chunk;service.completeChunkUpload=originals.complete;globalThis.window=previousWindow}
|
||||
})
|
||||
test('small file initialization never requests a chunk bigger than the file',async()=>{
|
||||
const originalInit=service.initChunkUpload;let size
|
||||
const previousWindow=globalThis.window;globalThis.window={isSecureContext:true}
|
||||
service.initChunkUpload=async request=>{size=request.chunk_size;return {code:200,detail:{existed:true,code:'existing'}}}
|
||||
try{await upload(new File(['small'],'a.txt'),{expireValue:1,expireStyle:'day'});assert.equal(size,5)}finally{service.initChunkUpload=originalInit;globalThis.window=previousWindow}
|
||||
})
|
||||
Reference in new issue
Block a user