Force.com-JavaScript-REST-Toolkit icon indicating copy to clipboard operation
Force.com-JavaScript-REST-Toolkit copied to clipboard

Problem with xlsx and docx

Open builderdege opened this issue 7 years ago • 2 comments

Hi,

You have a problem with this code: var blob = new Blob([ "--boundary_" + boundary + '\n' + "Content-Disposition: form-data; name=\"entity_content\";" + "\n" + "Content-Type: application/json" + "\n\n" + JSON.stringify(fields) + "\n\n" + "--boundary_" + boundary + "\n" + "Content-Type: application/octet-stream" + "\n" + "Content-Disposition: form-data; name=\"" + payloadField + "\"; filename=\"" + filename + "\"\n\n", payload, "\n\n" + "--boundary_" + boundary + "--" ], {type : 'multipart/form-data; boundary=\"boundary_' + boundary + '\"'});

It should be: var blob = new Blob([ "--boundary_" + boundary + '\n' + "Content-Disposition: form-data; name=\"entity_content\";" + "\n" + "Content-Type: application/json" + "\n\n" + JSON.stringify(fields) + "\n\n" + "--boundary_" + boundary + "\n" + "Content-Type: application/octet-stream" + "\n" + "Content-Disposition: form-data; name=\"" + payloadField + "\"; filename=\"" + filename + "\"\n\n", payload, "\n" + "--boundary_" + boundary + "--" ], {type : 'multipart/form-data; boundary=\"boundary_' + boundary + '\"'});

The extra line corrupts the xlsx and docx files.

Thanks, Yishay

builderdege avatar Jan 18 '18 09:01 builderdege

Thanks Yishay!

pbergner avatar Feb 22 '18 01:02 pbergner

hello i want to help you guys

yassin014 avatar Jan 21 '23 18:01 yassin014