zahmis 5 年 前
コミット
7c1be58085
1 ファイル変更3 行追加4 行削除
  1. 3 4
      src/server/routes/apiv3/pages.js

+ 3 - 4
src/server/routes/apiv3/pages.js

@@ -429,6 +429,9 @@ module.exports = (crowi) => {
       return res.apiv3Err(new ErrorV3('Not Founded the page', 'notfound_or_forbidden'), 404);
       return res.apiv3Err(new ErrorV3('Not Founded the page', 'notfound_or_forbidden'), 404);
     }
     }
 
 
+    // check whether path starts slash
+    newPagePath = pathUtils.addHeadingSlash(newPagePath);
+
     // population
     // population
     await page.populate({ path: 'revision', model: 'Revision', select: 'body' }).execPopulate();
     await page.populate({ path: 'revision', model: 'Revision', select: 'body' }).execPopulate();
 
 
@@ -438,10 +441,6 @@ module.exports = (crowi) => {
     options.grantUserGroupId = page.grantedGroup;
     options.grantUserGroupId = page.grantedGroup;
     options.grantedUsers = page.grantedUsers;
     options.grantedUsers = page.grantedUsers;
 
 
-    // check whether path starts slash
-    newPagePath = pathUtils.addHeadingSlash(newPagePath);
-
-
     const createdPage = await Page.create(newPagePath, page.revision.body, req.user, options);
     const createdPage = await Page.create(newPagePath, page.revision.body, req.user, options);
 
 
     const originTags = await page.findRelatedTagsById();
     const originTags = await page.findRelatedTagsById();