From 105192dc3de2e903cdea1b8f236d632c7449f8ca Mon Sep 17 00:00:00 2001 From: Mathias Buus Date: Fri, 27 Apr 2018 17:40:46 +0200 Subject: [PATCH] tweak #83 --- extract.js | 4 ++-- test/extract.js | 6 +++--- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/extract.js b/extract.js index aa0830f..19a4255 100644 --- a/extract.js +++ b/extract.js @@ -182,8 +182,8 @@ var Extract = function (opts) { self._parse(header.size, onstreamend) oncontinue() } - this._onheader = onheader + this._onheader = onheader this._parse(512, onheader) } @@ -251,7 +251,7 @@ Extract.prototype._write = function (data, enc, cb) { } Extract.prototype._final = function (cb) { - if (this._partial) cb(new Error('unexpected end of data')) + if (this._partial) return this.destroy(new Error('Unexpected end of data')) cb() } diff --git a/test/extract.js b/test/extract.js index 343a45a..a244c0b 100644 --- a/test/extract.js +++ b/test/extract.js @@ -572,7 +572,7 @@ test('latin-1', function (t) { // can unpack filenames encoded in latin-1 }) test('incomplete', function (t) { - t.plan(2) + t.plan(1) var extract = tar.extract() @@ -581,11 +581,11 @@ test('incomplete', function (t) { }) extract.on('error', function (err) { - t.same(err.message, 'unexpected end of data') + t.same(err.message, 'Unexpected end of data') }) extract.on('finish', function () { - t.ok(true) + t.fail('should not finish') }) extract.end(fs.readFileSync(fixtures.INCOMPLETE_TAR))