Skip to content

Commit 15e667f

Browse files
authored
feat: send file mime to multi-part upload (#518)
1 parent 39bc7ec commit 15e667f

File tree

2 files changed

+9
-1
lines changed

2 files changed

+9
-1
lines changed

src/runtime/blob/app/composables/useMultipartUpload.ts

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,10 @@ export function useMultipartUpload(
3030
pathname: string
3131
uploadId: string
3232
}>(prefix ? joinURL('/create', prefix, file.name) : joinURL('/create', file.name), {
33-
method: 'POST'
33+
method: 'POST',
34+
headers: {
35+
'x-nuxthub-file-content-type': file.type
36+
}
3437
})
3538

3639
const upload = (

src/runtime/blob/server/utils/blob.ts

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -508,6 +508,11 @@ function createMultipartUploadHandler(
508508
pathname: z.string().min(1)
509509
}).parse)
510510

511+
options ||= {}
512+
if (getHeader(event, 'x-nuxthub-file-content-type')) {
513+
options.contentType ||= getHeader(event, 'x-nuxthub-file-content-type')
514+
}
515+
511516
try {
512517
const object = await createMultipartUpload(pathname, options)
513518
return {

0 commit comments

Comments
 (0)