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

deleted comments and retricter regexp

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

+ 1 - 2
lib/models/page.js

@@ -534,13 +534,12 @@ module.exports = function(crowi) {
     const Page = this;
     const Page = this;
     const templatePath = cutOffLastSlash(path);
     const templatePath = cutOffLastSlash(path);
     const pathList = generatePathsOnTree(templatePath, []);
     const pathList = generatePathsOnTree(templatePath, []);
-    const regexpList = pathList.map(path => new RegExp(`${path}/_{1,2}template$`));
+    const regexpList = pathList.map(path => new RegExp(`^${path}/_{1,2}template$`));
 
 
     return Page
     return Page
       .find({path: {$in: regexpList}})
       .find({path: {$in: regexpList}})
       .populate({path: 'revision', model: 'Revision'})
       .populate({path: 'revision', model: 'Revision'})
       .then(templates => {
       .then(templates => {
-        templates.forEach(temp => {console.log(temp.path)})
         return fetchTemplate(templates, templatePath);
         return fetchTemplate(templates, templatePath);
       });
       });
   };
   };