mirror of
https://github.com/TryGhost/Ghost.git
synced 2024-12-25 20:03:12 +03:00
🐛 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:
parent
c192dcc36d
commit
a4cf470c87
@ -172,7 +172,7 @@ _.extend(ImportManager.prototype, {
|
|||||||
const tmpDir = path.join(os.tmpdir(), uuid.v4());
|
const tmpDir = path.join(os.tmpdir(), uuid.v4());
|
||||||
this.fileToDelete = tmpDir;
|
this.fileToDelete = tmpDir;
|
||||||
|
|
||||||
return extract(filePath, {dir: tmpDir}).then(function () {
|
return extract(filePath, tmpDir).then(function () {
|
||||||
return tmpDir;
|
return tmpDir;
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
|
@ -203,6 +203,21 @@ describe('Importer', function () {
|
|||||||
should.not.exist(ImportManager.getBaseDirectory(testDir));
|
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
|
// Step 2 of importing is preProcess
|
||||||
|
Loading…
Reference in New Issue
Block a user