mirror of
https://github.com/saltbo/zpan.git
synced 2026-08-29 00:01:42 +08:00
fix(storage): presign multipart complete without body
This commit is contained in:
@@ -271,6 +271,7 @@ describe('S3Service', () => {
|
||||
})
|
||||
|
||||
it('completes multipart uploads through a presigned POST XML body', async () => {
|
||||
const { getSignedUrl } = await import('@aws-sdk/s3-request-presigner')
|
||||
const fetchMock = vi.fn().mockResolvedValueOnce(new Response('<CompleteMultipartUploadResult />'))
|
||||
vi.stubGlobal('fetch', fetchMock)
|
||||
|
||||
@@ -286,6 +287,13 @@ describe('S3Service', () => {
|
||||
headers: { 'Content-Type': 'application/xml' },
|
||||
body: '<CompleteMultipartUpload><Part><PartNumber>1</PartNumber><ETag>"etag-1"</ETag></Part><Part><PartNumber>2</PartNumber><ETag>"etag&2"</ETag></Part></CompleteMultipartUpload>',
|
||||
})
|
||||
expect(getSignedUrl).toHaveBeenCalledWith(
|
||||
expect.anything(),
|
||||
expect.objectContaining({
|
||||
input: { Bucket: 'my-bucket', Key: 'video.mp4', UploadId: 'upload-1' },
|
||||
}),
|
||||
expect.anything(),
|
||||
)
|
||||
expect(mockSend).not.toHaveBeenCalled()
|
||||
})
|
||||
|
||||
|
||||
@@ -107,7 +107,6 @@ export class S3Service {
|
||||
Bucket: storage.bucket,
|
||||
Key: key,
|
||||
UploadId: uploadId,
|
||||
MultipartUpload: { Parts: sortedParts },
|
||||
}),
|
||||
{ expiresIn: DEFAULT_EXPIRES_IN },
|
||||
)
|
||||
|
||||
Reference in New Issue
Block a user