mirror of
https://github.com/apache/cordova-plugin-file-transfer.git
synced 2026-04-10 00:00:03 +08:00
[windows] Fix js error "The parameter is incorrect" (#199)
<!-- Please make sure the checklist boxes are all checked before submitting the PR. The checklist is intended as a quick reference, for complete details please see our Contributor Guidelines: http://cordova.apache.org/contribute/contribute_guidelines.html Thanks! --> ### 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.
This commit is contained in:
committed by
Jan Piotrowski
parent
2e4539d406
commit
6c99dfa8d9
@@ -499,6 +499,10 @@ exec(win, fail, 'FileTransfer', 'upload',
|
|||||||
if (!response) {
|
if (!response) {
|
||||||
resolve(new FTErr(FTErr.CONNECTION_ERR, source, target));
|
resolve(new FTErr(FTErr.CONNECTION_ERR, source, target));
|
||||||
} else {
|
} 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));
|
var reader = new Windows.Storage.Streams.DataReader(download.getResultStreamAt(0));
|
||||||
reader.loadAsync(download.progress.bytesReceived).then(function (bytesLoaded) {
|
reader.loadAsync(download.progress.bytesReceived).then(function (bytesLoaded) {
|
||||||
var payload = reader.readString(bytesLoaded);
|
var payload = reader.readString(bytesLoaded);
|
||||||
|
|||||||
Reference in New Issue
Block a user