fix: always prefix lang for non-default language in disk storage module (#1000)
This commit is contained in:
parent
7a582f7146
commit
eac12121bb
@ -59,7 +59,7 @@ module.exports = {
|
|||||||
async created(page) {
|
async created(page) {
|
||||||
WIKI.logger.info(`(STORAGE/DISK) Creating file ${page.path}...`)
|
WIKI.logger.info(`(STORAGE/DISK) Creating file ${page.path}...`)
|
||||||
let fileName = `${page.path}.${getFileExtension(page.contentType)}`
|
let fileName = `${page.path}.${getFileExtension(page.contentType)}`
|
||||||
if (WIKI.config.lang.namespacing && WIKI.config.lang.code !== page.localeCode) {
|
if (WIKI.config.lang.code !== page.localeCode) {
|
||||||
fileName = `${page.localeCode}/${fileName}`
|
fileName = `${page.localeCode}/${fileName}`
|
||||||
}
|
}
|
||||||
const filePath = path.join(this.config.path, fileName)
|
const filePath = path.join(this.config.path, fileName)
|
||||||
@ -68,7 +68,7 @@ module.exports = {
|
|||||||
async updated(page) {
|
async updated(page) {
|
||||||
WIKI.logger.info(`(STORAGE/DISK) Updating file ${page.path}...`)
|
WIKI.logger.info(`(STORAGE/DISK) Updating file ${page.path}...`)
|
||||||
let fileName = `${page.path}.${getFileExtension(page.contentType)}`
|
let fileName = `${page.path}.${getFileExtension(page.contentType)}`
|
||||||
if (WIKI.config.lang.namespacing && WIKI.config.lang.code !== page.localeCode) {
|
if (WIKI.config.lang.code !== page.localeCode) {
|
||||||
fileName = `${page.localeCode}/${fileName}`
|
fileName = `${page.localeCode}/${fileName}`
|
||||||
}
|
}
|
||||||
const filePath = path.join(this.config.path, fileName)
|
const filePath = path.join(this.config.path, fileName)
|
||||||
@ -77,7 +77,7 @@ module.exports = {
|
|||||||
async deleted(page) {
|
async deleted(page) {
|
||||||
WIKI.logger.info(`(STORAGE/DISK) Deleting file ${page.path}...`)
|
WIKI.logger.info(`(STORAGE/DISK) Deleting file ${page.path}...`)
|
||||||
let fileName = `${page.path}.${getFileExtension(page.contentType)}`
|
let fileName = `${page.path}.${getFileExtension(page.contentType)}`
|
||||||
if (WIKI.config.lang.namespacing && WIKI.config.lang.code !== page.localeCode) {
|
if (WIKI.config.lang.code !== page.localeCode) {
|
||||||
fileName = `${page.localeCode}/${fileName}`
|
fileName = `${page.localeCode}/${fileName}`
|
||||||
}
|
}
|
||||||
const filePath = path.join(this.config.path, fileName)
|
const filePath = path.join(this.config.path, fileName)
|
||||||
@ -88,7 +88,7 @@ module.exports = {
|
|||||||
let sourceFilePath = `${page.sourcePath}.${getFileExtension(page.contentType)}`
|
let sourceFilePath = `${page.sourcePath}.${getFileExtension(page.contentType)}`
|
||||||
let destinationFilePath = `${page.destinationPath}.${getFileExtension(page.contentType)}`
|
let destinationFilePath = `${page.destinationPath}.${getFileExtension(page.contentType)}`
|
||||||
|
|
||||||
if (WIKI.config.lang.namespacing && WIKI.config.lang.code !== page.localeCode) {
|
if (WIKI.config.lang.code !== page.localeCode) {
|
||||||
sourceFilePath = `${page.localeCode}/${sourceFilePath}`
|
sourceFilePath = `${page.localeCode}/${sourceFilePath}`
|
||||||
destinationFilePath = `${page.localeCode}/${destinationFilePath}`
|
destinationFilePath = `${page.localeCode}/${destinationFilePath}`
|
||||||
}
|
}
|
||||||
@ -108,7 +108,7 @@ module.exports = {
|
|||||||
objectMode: true,
|
objectMode: true,
|
||||||
transform: async (page, enc, cb) => {
|
transform: async (page, enc, cb) => {
|
||||||
let fileName = `${page.path}.${getFileExtension(page.contentType)}`
|
let fileName = `${page.path}.${getFileExtension(page.contentType)}`
|
||||||
if (WIKI.config.lang.namespacing && WIKI.config.lang.code !== page.localeCode) {
|
if (WIKI.config.lang.code !== page.localeCode) {
|
||||||
fileName = `${page.localeCode}/${fileName}`
|
fileName = `${page.localeCode}/${fileName}`
|
||||||
}
|
}
|
||||||
WIKI.logger.info(`(STORAGE/DISK) Dumping ${fileName}...`)
|
WIKI.logger.info(`(STORAGE/DISK) Dumping ${fileName}...`)
|
||||||
|
Loading…
Reference in New Issue
Block a user