Skip to content

Commit

Permalink
Ugly workaround for pages named with unicode characters. Untested (ta…
Browse files Browse the repository at this point in the history
…ken from other version).
  • Loading branch information
budden committed Feb 15, 2018
1 parent 4a5aa48 commit 781fcad
Showing 1 changed file with 22 additions and 2 deletions.
24 changes: 22 additions & 2 deletions lib/common/utils.js
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down

0 comments on commit 781fcad

Please sign in to comment.