You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cordova.apache.org by sg...@apache.org on 2015/03/05 10:25:32 UTC

cordova-plugin-file-transfer git commit: CB-8590 (Windows) Fixed download.onprogress.lengthComputable

Repository: cordova-plugin-file-transfer
Updated Branches:
  refs/heads/master dc2161be2 -> 3ff838292


CB-8590 (Windows) Fixed download.onprogress.lengthComputable

github close #67


Project: http://git-wip-us.apache.org/repos/asf/cordova-plugin-file-transfer/repo
Commit: http://git-wip-us.apache.org/repos/asf/cordova-plugin-file-transfer/commit/3ff83829
Tree: http://git-wip-us.apache.org/repos/asf/cordova-plugin-file-transfer/tree/3ff83829
Diff: http://git-wip-us.apache.org/repos/asf/cordova-plugin-file-transfer/diff/3ff83829

Branch: refs/heads/master
Commit: 3ff8382929c35aa3a8d8a0d507ae5a01fb714834
Parents: dc2161b
Author: alsorokin <al...@akvelon.com>
Authored: Thu Mar 5 10:56:42 2015 +0300
Committer: sgrebnov <v-...@microsoft.com>
Committed: Thu Mar 5 12:24:57 2015 +0300

----------------------------------------------------------------------
 src/windows/FileTransferProxy.js | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cordova-plugin-file-transfer/blob/3ff83829/src/windows/FileTransferProxy.js
----------------------------------------------------------------------
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 });
                 });


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@cordova.apache.org
For additional commands, e-mail: commits-help@cordova.apache.org