Skip to content

Commit

Permalink
companion: avoid bad mutation of file object
Browse files Browse the repository at this point in the history
  • Loading branch information
ifedapoolarewaju committed Jun 5, 2019
1 parent 58fcc46 commit 0d77dd6
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion packages/@uppy/companion/src/server/Uploader.js
Original file line number Diff line number Diff line change
Expand Up @@ -392,14 +392,17 @@ class Uploader {
this.options.metadata,
{
[this.options.fieldname]: {
value: file,
options: {
filename: this.uploadFileName,
contentType: this.options.metadata.type
}
}
}
)
// avoid setting file value through "Object.assign"
// to prevent this issue https://github.com/request/request/issues/2366#issuecomment-400646265
formData[this.options.fieldname].value = file

const headers = headerSanitize(this.options.headers)
request.post({ url: this.options.endpoint, headers, formData, encoding: null }, (error, response, body) => {
if (error) {
Expand Down

0 comments on commit 0d77dd6

Please sign in to comment.