Browse Source

Improved getPathFromRequest

Taichi Masuyama 4 years ago
parent
commit
5105581954
1 changed files with 2 additions and 2 deletions
  1. 2 2
      packages/app/src/server/routes/page.js

+ 2 - 2
packages/app/src/server/routes/page.js

@@ -168,7 +168,7 @@ module.exports = function(crowi, app) {
   const actions = {};
   const actions = {};
 
 
   function getPathFromRequest(req) {
   function getPathFromRequest(req) {
-    return pathUtils.normalizePath(req.params[0] || '');
+    return pathUtils.normalizePath(req.pagePath || req.params[0] || '');
   }
   }
 
 
   function isUserPage(path) {
   function isUserPage(path) {
@@ -290,7 +290,7 @@ module.exports = function(crowi, app) {
   }
   }
 
 
   async function _notFound(req, res) {
   async function _notFound(req, res) {
-    const path = req.pagePath || getPathFromRequest(req);
+    const path = getPathFromRequest(req);
 
 
     let view;
     let view;
     const renderVars = { path };
     const renderVars = { path };