diff --git a/ghost/core/core/server/data/importer/import-manager.js b/ghost/core/core/server/data/importer/import-manager.js index 6de8825c73..a7b0053564 100644 --- a/ghost/core/core/server/data/importer/import-manager.js +++ b/ghost/core/core/server/data/importer/import-manager.js @@ -301,14 +301,7 @@ class ImportManager { const baseDir = this.getBaseDirectory(zipDirectory); for (const handler of this.handlers) { - let files = []; - if (handler.directories?.length > 0) { - for (const dir of handler.directories) { - files.push(...this.getFilesFromZip(handler, path.join(zipDirectory, (baseDir || ''), dir))); - } - } else { - files.push(...this.getFilesFromZip(handler, zipDirectory)); - } + const files = this.getFilesFromZip(handler, zipDirectory); debug('handler', handler.type, files); diff --git a/ghost/core/test/unit/server/data/importer/index.test.js b/ghost/core/test/unit/server/data/importer/index.test.js index b3e837c819..a95569465a 100644 --- a/ghost/core/test/unit/server/data/importer/index.test.js +++ b/ghost/core/test/unit/server/data/importer/index.test.js @@ -228,7 +228,7 @@ describe('Importer', function () { extractSpy.calledOnce.should.be.true(); validSpy.calledOnce.should.be.true(); baseDirSpy.calledOnce.should.be.true(); - getFileSpy.callCount.should.eql(9); + getFileSpy.callCount.should.eql(6); jsonSpy.calledOnce.should.be.true(); imageSpy.called.should.be.false(); mdSpy.called.should.be.false(); diff --git a/ghost/core/test/utils/fixtures/import/zips/zip-uppercase-extensions/images/image.JPG b/ghost/core/test/utils/fixtures/import/zips/zip-uppercase-extensions/image.JPG similarity index 100% rename from ghost/core/test/utils/fixtures/import/zips/zip-uppercase-extensions/images/image.JPG rename to ghost/core/test/utils/fixtures/import/zips/zip-uppercase-extensions/image.JPG diff --git a/ghost/importer-handler-content-files/test/ImporterContentFileHandler.test.js b/ghost/importer-handler-content-files/test/ImporterContentFileHandler.test.js index d0c842dfd7..aefbe872de 100644 --- a/ghost/importer-handler-content-files/test/ImporterContentFileHandler.test.js +++ b/ghost/importer-handler-content-files/test/ImporterContentFileHandler.test.js @@ -52,24 +52,16 @@ describe('ImporterContentFileHandler', function () { }); const files = [{ - name: 'content/media/video-in-content-media.mp4' - }, { - name: 'media/video-in-media.mp4' + name: 'content/media/1.mp4' }]; const subDir = 'blog'; await contentFileImporter.loadFile(files, subDir); - assert.equal(files.length, 2); - assert.equal(files[0].name, 'video-in-content-media.mp4'); - assert.equal(files[0].originalPath, 'content/media/video-in-content-media.mp4'); + assert.equal(files[0].name, '1.mp4'); + assert.equal(files[0].originalPath, 'content/media/1.mp4'); assert.equal(files[0].targetDir, '/var/www/ghost/content/media'); - assert.equal(files[0].newPath, '//blog/content/media/video-in-content-media.mp4'); - - assert.equal(files[1].name, 'video-in-media.mp4'); - assert.equal(files[1].originalPath, 'media/video-in-media.mp4'); - assert.equal(files[1].targetDir, '/var/www/ghost/content/media'); - assert.equal(files[1].newPath, '//blog/content/media/video-in-media.mp4'); + assert.equal(files[0].newPath, '//blog/content/media/1.mp4'); }); it('loads files and decorates them with newPath with NO subdirectory', async function () {