From 116e69afcdc0a0fa340b30590531a9951e9b4625 Mon Sep 17 00:00:00 2001 From: Naz Date: Thu, 2 Mar 2023 16:34:21 +0800 Subject: [PATCH] Refactored importer's content file handler refs https://github.com/TryGhost/Toolbox/issues/523 - Renamed variables that were too media-specific --- .../lib/ImporterContentFileHandler.js | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/ghost/importer-handler-content-files/lib/ImporterContentFileHandler.js b/ghost/importer-handler-content-files/lib/ImporterContentFileHandler.js index 8258605b35..a7bbafc032 100644 --- a/ghost/importer-handler-content-files/lib/ImporterContentFileHandler.js +++ b/ghost/importer-handler-content-files/lib/ImporterContentFileHandler.js @@ -43,23 +43,23 @@ class ImporterContentFileHandler { async loadFile(files, baseDir) { const baseDirRegex = baseDir ? new RegExp('^' + baseDir + '/') : new RegExp(''); - const mediaFolderRegexes = _.map(this.storage.staticFileURLPrefix.split('/'), function (dir) { + const contentFilesFolderRegexes = _.map(this.storage.staticFileURLPrefix.split('/'), function (dir) { return new RegExp('^' + dir + '/'); }); // normalize the directory structure - const mediaContentPath = this.#contentPath; + const filesContentPath = this.#contentPath; files = _.map(files, function (file) { const noBaseDir = file.name.replace(baseDirRegex, ''); let noGhostDirs = noBaseDir; - _.each(mediaFolderRegexes, function (regex) { + _.each(contentFilesFolderRegexes, function (regex) { noGhostDirs = noGhostDirs.replace(regex, ''); }); file.originalPath = noBaseDir; file.name = noGhostDirs; - file.targetDir = path.join(mediaContentPath, path.dirname(noGhostDirs)); + file.targetDir = path.join(filesContentPath, path.dirname(noGhostDirs)); return file; }); @@ -70,7 +70,7 @@ class ImporterContentFileHandler { '/', self.urlUtils.getSubdir(), self.storage.staticFileURLPrefix, - path.relative(mediaContentPath, targetFilename) + path.relative(filesContentPath, targetFilename) ); return contentFile;