cordova-plugin-file-transfer icon indicating copy to clipboard operation
cordova-plugin-file-transfer copied to clipboard

[windows] Fix js error 'The parameter is incorrect' for upload

Open PabbleDabble opened this issue 5 years ago • 0 comments

Platforms affected

Windows

Motivation and Context

There was a similar PR recenly - https://github.com/apache/cordova-plugin-file-transfer/pull/199 - that fixed this error for Windows on the download portion of the code.
I was testing this plugin, trying to upload files, and our directory was set as read only to test failing the download. An unhandled exception would be thrown and crash our Windows app. This is a catch for that exception.

Description

When upload.progress.bytesReceived is 0, this fix will catch that case very similar to the download fix, and resolve an error and stop the function.

Testing

Manual testing - Loaded our app with my changed version of the plugin installed. The download still failed, as intended to a read only directory, but the app did not crash, and our file upload call was able to receive the 500 error.

Checklist

  • [ ] I've run the tests to see all new and existing tests pass
  • [ ] I added automated test coverage as appropriate for this change
  • [x] Commit is prefixed with (platform) if this change only applies to one platform (e.g. (android))
  • [ ] If this Pull Request resolves an issue, I linked to the issue in the text above (and used the correct keyword to close issues using keywords)
  • [x] I've updated the documentation if necessary

PabbleDabble avatar Mar 07 '19 13:03 PabbleDabble