Skip to content

Commit

Permalink
@uppy/aws-s3-multipart: fix support for non-multipart PUT upload (#4568)
Browse files Browse the repository at this point in the history
  • Loading branch information
aduh95 authored Jul 11, 2023
1 parent 7dcf8c2 commit 6ae15f4
Showing 1 changed file with 10 additions and 4 deletions.
14 changes: 10 additions & 4 deletions packages/@uppy/aws-s3-multipart/src/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -223,16 +223,22 @@ class HTTPCommunicationQueue {
headers,
} = await this.#getUploadParameters(file, { signal }).abortOn(signal)

const formData = new FormData()
Object.entries(fields).forEach(([key, value]) => formData.set(key, value))
let body
const data = chunk.getData()
formData.set('file', data)
if (method === 'post') {
const formData = new FormData()
Object.entries(fields).forEach(([key, value]) => formData.set(key, value))
formData.set('file', data)
body = formData
} else {
body = data
}

const { onProgress, onComplete } = chunk

return this.#uploadPartBytes({
signature: { url, headers, method },
body: formData,
body,
size: data.size,
onProgress,
onComplete,
Expand Down

0 comments on commit 6ae15f4

Please sign in to comment.