From 781fcadeb37007c087058dff99df1b8ac3bcc333 Mon Sep 17 00:00:00 2001 From: Denis Budyak Date: Thu, 15 Feb 2018 23:14:43 +0300 Subject: [PATCH] Ugly workaround for pages named with unicode characters. Untested (taken from other version). --- lib/common/utils.js | 24 ++++++++++++++++++++++-- 1 file changed, 22 insertions(+), 2 deletions(-) diff --git a/lib/common/utils.js b/lib/common/utils.js index 710eccf5199c..5a7861457850 100644 --- a/lib/common/utils.js +++ b/lib/common/utils.js @@ -254,7 +254,23 @@ function cleanChildrenRoutes(routes, isChild = false) { return routes } -exports.createRoutes = function createRoutes(files, srcDir, pagesDir) { +exports.createRoutes = function createRoutes(files, srcDir) { + + const cloneObject = function(obj) { + var newObj = {}; + + for (var prop in obj) { + if (typeof obj[prop] == 'object') { + newObj[prop] = cloneObject(obj[prop]); + } else { + newObj[prop] = obj[prop]; + } + } + + return newObj; + } + + let routes = [] files.forEach(file => { let keys = file @@ -287,8 +303,12 @@ exports.createRoutes = function createRoutes(files, srcDir, pagesDir) { } } }) + const route2 = cloneObject(route); + route2.path = encodeURI(route2.path); + // Order Routes path - parent.push(route) + parent.push(route); + parent.push(route2); parent.sort((a, b) => { if (!a.path.length) { return -1