mirror of
https://github.com/TryGhost/Ghost.git
synced 2025-01-20 22:42:53 -05:00
Merge pull request #2719 from appleYaks/import-backward-compatible
Make DB Import backwards compatible
This commit is contained in:
commit
25ec0f3f75
1 changed files with 5 additions and 0 deletions
|
@ -63,6 +63,11 @@ db = {
|
|||
// Parse the json data
|
||||
try {
|
||||
importData = JSON.parse(fileContents);
|
||||
|
||||
// if importData follows JSON-API format `{ db: [exportedData] }`
|
||||
if (_.keys(importData).length === 1 && Array.isArray(importData.db)) {
|
||||
importData = importData.db[0];
|
||||
}
|
||||
} catch (e) {
|
||||
errors.logError(e, "API DB import content", "check that the import file is valid JSON.");
|
||||
return when.reject(new errors.BadRequest("Failed to parse the import JSON file"));
|
||||
|
|
Loading…
Add table
Reference in a new issue