apache / cordova-plugin-file-transfer

Apache Cordova File Transfer Plugin
https://cordova.apache.org/
Apache License 2.0
595 stars 888 forks source link

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

Closed PabbleDabble closed 10 months ago

PabbleDabble commented 5 years ago

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

jcesarmobile commented 10 months ago

Thanks for the PR, but windows platform is deprecated and it’s code has been removed from the plugin