diff --git a/ghost/core/core/server/api/endpoints/db.js b/ghost/core/core/server/api/endpoints/db.js index f874104c89..d2f95d416e 100644 --- a/ghost/core/core/server/api/endpoints/db.js +++ b/ghost/core/core/server/api/endpoints/db.js @@ -71,8 +71,8 @@ module.exports = { importContent: { statusCode(result) { - if (result && (result.data || result.images)) { - return 201; + if (result && (result.db || result.problems)) { + return 200; } else { return 202; } diff --git a/ghost/core/core/server/data/importer/import-manager.js b/ghost/core/core/server/data/importer/import-manager.js index 45dca91d20..d4f94f43bf 100644 --- a/ghost/core/core/server/data/importer/import-manager.js +++ b/ghost/core/core/server/data/importer/import-manager.js @@ -4,6 +4,7 @@ const path = require('path'); const os = require('os'); const glob = require('glob'); const uuid = require('uuid'); +const config = require('../../../shared/config'); const {extract} = require('@tryghost/zip'); const tpl = require('@tryghost/tpl'); const logging = require('@tryghost/logging'); @@ -401,7 +402,8 @@ class ImportManager { * @returns {Promise>} */ async importFromFile(file, importOptions = {}) { - if (!importOptions.forceInline && !importOptions.runningInJob) { + const env = config.get('env'); + if (!env?.startsWith('testing') && !importOptions.runningInJob) { return jobManager.addJob({ job: () => this.importFromFile(file, Object.assign({}, importOptions, { runningInJob: true @@ -434,7 +436,7 @@ class ImportManager { // Step 5: Cleanup any files await this.cleanUp(); - if (!importOptions.forceInline) { + if (!env?.startsWith('testing')) { // Step 6: Send email const email = this.generateCompletionEmail(importResult?.data, { emailRecipient: importOptions.user.email, @@ -454,7 +456,6 @@ class ImportManager { /** * @typedef {object} ImportOptions - * @property {boolean} [forceInline] * @property {boolean} [runningInJob] * @property {boolean} [returnImportedData] * @property {boolean} [importPersistUser] diff --git a/ghost/core/core/server/data/importer/importers/data/data-importer.js b/ghost/core/core/server/data/importer/importers/data/data-importer.js index a340dfd4da..a0c8aac09b 100644 --- a/ghost/core/core/server/data/importer/importers/data/data-importer.js +++ b/ghost/core/core/server/data/importer/importers/data/data-importer.js @@ -57,6 +57,9 @@ DataImporter = { name: importOptions.importTag, slug: slugify(importOptions.importTag) }); + if (!('posts_tags' in importData.data)) { + importData.data.posts_tags = []; + } for (const post of importData.data.posts || []) { if (!('id' in post)) { // Make sure post has an id if it doesn't already