Skip to content

Commit

Permalink
@uppy/aws-s3-multipart: fix uploadURL when using PUT (#4701)
Browse files Browse the repository at this point in the history
  • Loading branch information
aduh95 authored Oct 14, 2023
1 parent 8b25208 commit 81b0999
Showing 1 changed file with 13 additions and 1 deletion.
14 changes: 13 additions & 1 deletion packages/@uppy/aws-s3-multipart/src/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,13 @@ function assertServerError (res) {
return res
}

function removeMetadataFromURL (urlString) {
const urlObject = new URL(urlString)
urlObject.search = ''
urlObject.hash = ''
return urlObject.href
}

/**
* Computes the expiry time for a request signed with temporary credentials. If
* no expiration was provided, or an invalid value (e.g. in the past) is
Expand Down Expand Up @@ -260,14 +267,19 @@ class HTTPCommunicationQueue {

const { onProgress, onComplete } = chunk

return this.#uploadPartBytes({
const result = await this.#uploadPartBytes({
signature: { url, headers, method },
body,
size: data.size,
onProgress,
onComplete,
signal,
}).abortOn(signal)

return 'location' in result ? result : {
location: removeMetadataFromURL(url),
...result,
}
}

/**
Expand Down

0 comments on commit 81b0999

Please sign in to comment.