From 1b5aa390f1dccb6358a178b27b7398674bbee693 Mon Sep 17 00:00:00 2001 From: Hannah Wolfe Date: Tue, 20 Dec 2022 11:56:07 +0000 Subject: [PATCH] =?UTF-8?q?=F0=9F=90=9B=20Fixed=20meta=20is=20missing=20er?= =?UTF-8?q?ror=20with=20revue=20imports=20(#16033)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit refs: https://github.com/TryGhost/Ghost/commit/5f90baf6fe3bd9b9acdcc418a0e21389084030ee - The check for hasIssuesCSV didn't normalize the filename first, meaning the importer is super sensitive to zip structure - This allows for zips that contain a directory, so that it will still be processed as a revue import, not a Ghost import --- ghost/core/core/server/data/importer/handlers/revue.js | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/ghost/core/core/server/data/importer/handlers/revue.js b/ghost/core/core/server/data/importer/handlers/revue.js index e1cd0bc1d5..1f9476479d 100644 --- a/ghost/core/core/server/data/importer/handlers/revue.js +++ b/ghost/core/core/server/data/importer/handlers/revue.js @@ -2,9 +2,10 @@ const _ = require('lodash'); const fs = require('fs-extra'); const debug = require('@tryghost/debug')('importer:handler:revue'); -const hasIssuesCSV = (files) => { +const hasIssuesCSV = (files, startDirRegex) => { return _.some(files, (file) => { - return file.name.match(/^issues.*?\.csv/); + const name = file.name.replace(startDirRegex, ''); + return name.match(/^issues.*?\.csv/); }); }; @@ -21,7 +22,8 @@ const RevueHandler = { const ops = []; const revue = {}; - if (!hasIssuesCSV(files)) { + if (!hasIssuesCSV(files, startDirRegex)) { + debug('No issue CSV'); return Promise.resolve(); }