Skip to content

Commit

Permalink
Merge pull request #654 from cloudinary/fix/next-prod-build-upload-st…
Browse files Browse the repository at this point in the history
…ream

fix: file and field encoding fixed for next production build
  • Loading branch information
cloudinary-pkoniu committed Mar 5, 2024
2 parents 61b6650 + 2bb196a commit 2da1e52
Showing 1 changed file with 10 additions and 10 deletions.
20 changes: 10 additions & 10 deletions lib/uploader.js
Original file line number Diff line number Diff line change
Expand Up @@ -628,22 +628,22 @@ function post(url, post_data, boundary, file, callback, options) {

function encodeFieldPart(boundary, name, value) {
return [
`--${boundary}`,
`Content-Disposition: form-data; name="${name}"`,
'',
value,
`--${boundary}\r\n`,
`Content-Disposition: form-data; name="${name}"\r\n`,
'\r\n',
`${value}\r\n`,
''
].join("\r\n");
].join('');
}

function encodeFilePart(boundary, type, name, filename) {
return [
`--${boundary}`,
`Content-Disposition: form-data; name="${name}"; filename="${filename}"`,
`Content-Type: ${type}`,
'',
`--${boundary}\r\n`,
`Content-Disposition: form-data; name="${name}"; filename="${filename}"\r\n`,
`Content-Type: ${type}\r\n`,
'\r\n',
''
].join("\r\n");
].join('');
}

exports.direct_upload = function direct_upload(callback_url, options = {}) {
Expand Down

0 comments on commit 2da1e52

Please sign in to comment.