Просмотр исходного кода

modified generatePathsOnTree to allow empty string in the pathList

sou 7 лет назад
Родитель
Сommit
8cea50ce4f
1 измененных файлов с 3 добавлено и 1 удалено
  1. 3 1
      lib/models/page.js

+ 3 - 1
lib/models/page.js

@@ -548,6 +548,7 @@ module.exports = function(crowi) {
       childrenTemplateExists: false,
       decendantsTemplateExists: false,
     };
+    console.log('regexp', regexpList)
 
     return Page
       .find({path: {$in: regexpList}})
@@ -582,11 +583,12 @@ module.exports = function(crowi) {
   };
 
   const generatePathsOnTree = (path, pathList) => {
+    pathList.push(path);
+
     if (path === '') {
       return pathList;
     }
 
-    pathList.push(path);
     const newPath = cutOffLastSlash(path);
 
     return generatePathsOnTree(newPath, pathList);