[windows] Fix js error 'The parameter is incorrect' for upload #229
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Platforms affected
Windows
Motivation and Context
There was a similar PR recenly - #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
(platform)
if this change only applies to one platform (e.g.(android)
)