From 6c99dfa8d9938ec36a8dea63a6f8005a7c032956 Mon Sep 17 00:00:00 2001 From: Trong Tran Date: Tue, 2 Oct 2018 03:45:08 +0700 Subject: [PATCH] [windows] Fix js error "The parameter is incorrect" (#199) ### Platforms affected windows ### What does this PR do? Fix js error "The parameter is incorrect" when download progress is 0 in error handler ### What testing has been done on this change? Manual testing ### Checklist - [ ] [Reported an issue](http://cordova.apache.org/contribute/issues.html) in the JIRA database - [ ] Commit message follows the format: "CB-3232: (android) Fix bug with resolving file paths", where CB-xxxx is the JIRA ID & "android" is the platform affected. - [ ] Added automated test coverage as appropriate for this change. --- src/windows/FileTransferProxy.js | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/windows/FileTransferProxy.js b/src/windows/FileTransferProxy.js index 5d1363f..01e6e7b 100644 --- a/src/windows/FileTransferProxy.js +++ b/src/windows/FileTransferProxy.js @@ -499,6 +499,10 @@ exec(win, fail, 'FileTransfer', 'upload', if (!response) { resolve(new FTErr(FTErr.CONNECTION_ERR, source, target)); } else { + if (download.progress.bytesReceived === 0) { + resolve(new FTErr(FTErr.FILE_NOT_FOUND_ERR, source, target, response.statusCode, null, error)); + return; + } var reader = new Windows.Storage.Streams.DataReader(download.getResultStreamAt(0)); reader.loadAsync(download.progress.bytesReceived).then(function (bytesLoaded) { var payload = reader.readString(bytesLoaded);