From 1a36b720f1c620ab73afcb1dec16f24868c5269e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ey=C3=BE=C3=B3r=20Magn=C3=BAsson?= Date: Wed, 31 Oct 2018 18:31:37 +0100 Subject: [PATCH] fix(ext-tools): handle end of stream event When validating the hash of a downloaded binary, hash.read() returns null at the end of stream event. This wasn't handled properly before. --- garden-service/src/util/ext-tools.ts | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/garden-service/src/util/ext-tools.ts b/garden-service/src/util/ext-tools.ts index 3505be4f7a..1927dd7afc 100644 --- a/garden-service/src/util/ext-tools.ts +++ b/garden-service/src/util/ext-tools.ts @@ -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})`,