Skip to content

Commit

Permalink
fix(ext-tools): handle end of stream event
Browse files Browse the repository at this point in the history
When validating the hash of a downloaded binary, hash.read() returns
null at the end of stream event. This wasn't handled properly before.
  • Loading branch information
eysi09 committed Oct 31, 2018
1 parent 46123ae commit 1a36b72
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions garden-service/src/util/ext-tools.ts
Original file line number Diff line number Diff line change
Expand Up @@ -171,6 +171,11 @@ export class BinaryCmd extends Cmd {
// validate sha256 if provided
const sha256 = hash.read()

// end of stream event
if (sha256 === null) {
return
}

if (this.spec.sha256 && sha256 !== this.spec.sha256) {
reject(new DownloadError(
`Invalid checksum from ${this.spec.url} (got ${sha256})`,
Expand Down

0 comments on commit 1a36b72

Please sign in to comment.