From 0a7e7900716035eeeaae7902dbc7fafd35eb906b Mon Sep 17 00:00:00 2001 From: Gregory Schier Date: Tue, 25 Jul 2017 19:40:32 -0700 Subject: [PATCH] Fix binary file upload method --- app/network/network.js | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/app/network/network.js b/app/network/network.js index 1a5aa26696..49d4e1bf5a 100644 --- a/app/network/network.js +++ b/app/network/network.js @@ -398,9 +398,14 @@ export function _actuallySend ( const {size} = fs.statSync(renderedRequest.body.fileName); const fileName = renderedRequest.body.fileName || ''; const fd = fs.openSync(fileName, 'r+'); + setOpt(Curl.option.INFILESIZE, size); setOpt(Curl.option.UPLOAD, 1); setOpt(Curl.option.READDATA, fd); + + // We need this, otherwise curl will send it as a POST + setOpt(Curl.option.CUSTOMREQUEST, renderedRequest.method); + const fn = () => fs.closeSync(fd); curl.on('end', fn); curl.on('error', fn);