From f4816d06289ee282d0ce03b4dc9c41862719957a Mon Sep 17 00:00:00 2001 From: NGPixel Date: Fri, 18 Oct 2019 20:23:10 -0400 Subject: [PATCH] fix: pageHelper getFileExtension missing return --- server/helpers/page.js | 2 +- server/modules/storage/disk/storage.js | 9 +++++---- server/modules/storage/git/storage.js | 8 ++++---- 3 files changed, 10 insertions(+), 9 deletions(-) diff --git a/server/helpers/page.js b/server/helpers/page.js index 4471281e..286f8438 100644 --- a/server/helpers/page.js +++ b/server/helpers/page.js @@ -101,7 +101,7 @@ module.exports = { * Get file extension from content type */ getFileExtension(contentType) { - _.get(contentToExt, contentType, 'txt') + return _.get(contentToExt, contentType, 'txt') }, /** * Get content type from file extension diff --git a/server/modules/storage/disk/storage.js b/server/modules/storage/disk/storage.js index 4784618c..70cb44b5 100644 --- a/server/modules/storage/disk/storage.js +++ b/server/modules/storage/disk/storage.js @@ -45,7 +45,7 @@ module.exports = { } }, async created(page) { - WIKI.logger.info(`(STORAGE/DISK) Creating file ${page.path}...`) + WIKI.logger.info(`(STORAGE/DISK) Creating file [${page.localeCode}] ${page.path}...`) let fileName = `${page.path}.${pageHelper.getFileExtension(page.contentType)}` if (WIKI.config.lang.code !== page.localeCode) { fileName = `${page.localeCode}/${fileName}` @@ -54,7 +54,7 @@ module.exports = { await fs.outputFile(filePath, page.injectMetadata(), 'utf8') }, async updated(page) { - WIKI.logger.info(`(STORAGE/DISK) Updating file ${page.path}...`) + WIKI.logger.info(`(STORAGE/DISK) Updating file [${page.localeCode}] ${page.path}...`) let fileName = `${page.path}.${pageHelper.getFileExtension(page.contentType)}` if (WIKI.config.lang.code !== page.localeCode) { fileName = `${page.localeCode}/${fileName}` @@ -63,7 +63,7 @@ module.exports = { await fs.outputFile(filePath, page.injectMetadata(), 'utf8') }, async deleted(page) { - WIKI.logger.info(`(STORAGE/DISK) Deleting file ${page.path}...`) + WIKI.logger.info(`(STORAGE/DISK) Deleting file [${page.localeCode}] ${page.path}...`) let fileName = `${page.path}.${pageHelper.getFileExtension(page.contentType)}` if (WIKI.config.lang.code !== page.localeCode) { fileName = `${page.localeCode}/${fileName}` @@ -72,7 +72,8 @@ module.exports = { await fs.unlink(filePath) }, async renamed(page) { - WIKI.logger.info(`(STORAGE/DISK) Renaming file ${page.path} to ${page.destinationPath}...`) + WIKI.logger.info(`(STORAGE/DISK) Renaming file [${page.localeCode}] ${page.path} to [${page.destinationLocaleCode}] ${page.destinationPath}...`) + let sourceFilePath = `${page.path}.${pageHelper.getFileExtension(page.contentType)}` let destinationFilePath = `${page.destinationPath}.${pageHelper.getFileExtension(page.contentType)}` diff --git a/server/modules/storage/git/storage.js b/server/modules/storage/git/storage.js index 41052b93..20e76769 100644 --- a/server/modules/storage/git/storage.js +++ b/server/modules/storage/git/storage.js @@ -214,7 +214,7 @@ module.exports = { * @param {Object} page Page to create */ async created(page) { - WIKI.logger.info(`(STORAGE/GIT) Committing new file ${page.path}...`) + WIKI.logger.info(`(STORAGE/GIT) Committing new file [${page.localeCode}] ${page.path}...`) let fileName = `${page.path}.${pageHelper.getFileExtension(page.contentType)}` if (WIKI.config.lang.namespacing && WIKI.config.lang.code !== page.localeCode) { fileName = `${page.localeCode}/${fileName}` @@ -233,7 +233,7 @@ module.exports = { * @param {Object} page Page to update */ async updated(page) { - WIKI.logger.info(`(STORAGE/GIT) Committing updated file ${page.path}...`) + WIKI.logger.info(`(STORAGE/GIT) Committing updated file [${page.localeCode}] ${page.path}...`) let fileName = `${page.path}.${pageHelper.getFileExtension(page.contentType)}` if (WIKI.config.lang.namespacing && WIKI.config.lang.code !== page.localeCode) { fileName = `${page.localeCode}/${fileName}` @@ -252,7 +252,7 @@ module.exports = { * @param {Object} page Page to delete */ async deleted(page) { - WIKI.logger.info(`(STORAGE/GIT) Committing removed file ${page.path}...`) + WIKI.logger.info(`(STORAGE/GIT) Committing removed file [${page.localeCode}] ${page.path}...`) let fileName = `${page.path}.${pageHelper.getFileExtension(page.contentType)}` if (WIKI.config.lang.namespacing && WIKI.config.lang.code !== page.localeCode) { fileName = `${page.localeCode}/${fileName}` @@ -269,7 +269,7 @@ module.exports = { * @param {Object} page Page to rename */ async renamed(page) { - WIKI.logger.info(`(STORAGE/GIT) Committing file move from ${page.path} to ${page.destinationPath}...`) + WIKI.logger.info(`(STORAGE/GIT) Committing file move from [${page.localeCode}] ${page.path} to [${page.destinationLocaleCode}] ${page.destinationPath}...`) let sourceFilePath = `${page.path}.${pageHelper.getFileExtension(page.contentType)}` let destinationFilePath = `${page.destinationPath}.${pageHelper.getFileExtension(page.contentType)}`