plugins: manual_download: Resolve copyFile promise - #1786
Merged
Conversation
Codecov Report
@@ Coverage Diff @@
## master #1786 +/- ##
=======================================
Coverage 57.62% 57.62%
=======================================
Files 26 26
Lines 800 800
=======================================
Hits 461 461
Misses 339 339
Continue to review full report at Codecov.
|
Contributor
Author
|
Pushed the lint fix in a separate commit |
MarijnS95
reviewed
Feb 7, 2021
MarijnS95
reviewed
Feb 7, 2021
The whole block beginning with `.then(downloadedFilePath` and ending with `copyFile()` did not return anything and was never going to resolve its promise with an actual return value. That meant that that `checkFile()` was being called before any of the promise functions inside the previous block had the chance to run, therefore the copied file was not yet available, leading to checkFile trying to verify a non-existent path, leading to a checksum mismatch error. Solution is to make the whole block return something, in this case the value of the last chained promise, by removing the curly braces. Solves: ``` error: Error: core:manual_download: Error: checksum mismatch ``` Fixes #1754
Generated by `npm run lint-fix`
Contributor
Author
|
@NeoTheThird @UniversalSuperBox mind taking a look at this? |
Contributor
Author
|
Since Jan seems MIA currently, @Flohack74 would you like to review this? |
NeoTheThird
approved these changes
Mar 1, 2021
NeoTheThird
left a comment
Member
There was a problem hiding this comment.
lgtm, sorry for the delay and thanks for the contribution
Contributor
Author
Hey, you're under no obligation here. Thanks for writing this installer in the first place! |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
The whole block beginning with
.then(downloadedFilePathand ending withcopyFile()(^1) was never going to resolve its promise with an actual return value.That meant that that
checkFile()was being called before any of the promise functions inside the previous block hadthe chance to run, therefore the copied file was not yet available, leading to checkFile trying to verify a non-existent path, leading to a checksum mismatch error.
Solution is to make the whole block return something, in this case the value of the last chained promise.
Solves:
Fixes #1754
^1:
ubports-installer/src/core/plugins/core/plugin.js
Lines 205 to 219 in 95745e5