From 3ff8382929c35aa3a8d8a0d507ae5a01fb714834 Mon Sep 17 00:00:00 2001 From: alsorokin Date: Thu, 5 Mar 2015 10:56:42 +0300 Subject: [PATCH] CB-8590 (Windows) Fixed download.onprogress.lengthComputable github close #67 --- src/windows/FileTransferProxy.js | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/windows/FileTransferProxy.js b/src/windows/FileTransferProxy.js index 3d299ef..659e5c9 100644 --- a/src/windows/FileTransferProxy.js +++ b/src/windows/FileTransferProxy.js @@ -361,7 +361,9 @@ exec(win, fail, 'FileTransfer', 'upload', total: evt.progress.totalBytesToReceive, target: evt.resultFile }); - progressEvent.lengthComputable = true; + // when bytesReceived == 0, BackgroundDownloader has not yet differentiated whether it could get file length or not, + // when totalBytesToReceive == 0, BackgroundDownloader is unable to get file length + progressEvent.lengthComputable = (evt.progress.bytesReceived > 0) && (evt.progress.totalBytesToReceive > 0); successCallback(progressEvent, { keepCallback: true }); });