🐛 Fixed importer always erroring

- in 3.13.2 the importer always throws the error "The "path" argument must be of type string. Received an instance of Object"
- this is due to a change in method signature that wasn't accounted for
- added a test to catch similar changes to this code in future
This commit is contained in:
Hannah Wolfe 2020-04-15 13:23:45 +01:00
parent c192dcc36d
commit a4cf470c87
2 changed files with 16 additions and 1 deletions

View File

@ -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;
});
},

View File

@ -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