diff --git a/core/server/data/importer/index.js b/core/server/data/importer/index.js index 364fab97d1..9413333150 100644 --- a/core/server/data/importer/index.js +++ b/core/server/data/importer/index.js @@ -172,7 +172,7 @@ _.extend(ImportManager.prototype, { const tmpDir = path.join(os.tmpdir(), uuid.v4()); this.fileToDelete = tmpDir; - return extract(filePath, {dir: tmpDir}).then(function () { + return extract(filePath, tmpDir).then(function () { return tmpDir; }); }, diff --git a/test/unit/data/importer/index_spec.js b/test/unit/data/importer/index_spec.js index 1f68392ce8..7294620f99 100644 --- a/test/unit/data/importer/index_spec.js +++ b/test/unit/data/importer/index_spec.js @@ -203,6 +203,21 @@ describe('Importer', function () { should.not.exist(ImportManager.getBaseDirectory(testDir)); }); }); + + describe('Zip behaviour', function () { + it('can call extract and error correctly', function () { + return ImportManager + // Deliberately pass something that can't be extracted just to check this method signature is working + .extractZip('test/utils/fixtures/import/zips/zip-with-base-dir') + .then((res) => { + throw new Error('should have failed'); + }) + .catch((err) => { + err.message.should.match(/EISDIR/); + err.code.should.match(/EISDIR/); + }); + }); + }); }); // Step 2 of importing is preProcess