diff --git a/src/backupformat/tgz.js b/src/backupformat/tgz.js index b90057d1c..12b7ca446 100644 --- a/src/backupformat/tgz.js +++ b/src/backupformat/tgz.js @@ -35,6 +35,10 @@ function getBackupFilePath(backupConfig, remotePath) { } function addToPack(pack, header, options) { + assert.strictEqual(typeof pack, 'object'); + assert.strictEqual(typeof header, 'object'); + assert.strictEqual(typeof options, 'object'); // { input } + return new Promise((resolve, reject) => { const packEntry = safe(() => pack.entry(header, function (error) { if (error) { @@ -46,13 +50,9 @@ function addToPack(pack, header, options) { } })); - if (!packEntry) { - return reject(new BoxError(BoxError.FS_ERROR, `Failed to add ${header.name}: ${safe.error.message}`)); - } + if (!packEntry) return reject(new BoxError(BoxError.FS_ERROR, `Failed to add ${header.name}: ${safe.error.message}`)); - if (options?.input) { - safe(stream.pipeline(options.input, packEntry), { debug }); // background. rely on pack.entry callback for promise completion - } + if (options?.input) safe(stream.pipeline(options.input, packEntry), { debug }); // background. rely on pack.entry callback for promise completion }); }