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

ensure to redirect '/page/' to '/page'

Yuki Takei 8 лет назад
Родитель
Сommit
99c7a1a830
2 измененных файлов с 8 добавлено и 1 удалено
  1. 1 0
      lib/routes/index.js
  2. 7 1
      lib/routes/page.js

+ 1 - 0
lib/routes/index.js

@@ -144,6 +144,7 @@ module.exports = function(crowi, app) {
 
   // route for pages
   if ('crowi-plus' === Config.layoutType(config)) {
+    app.get('/*/$'                   , loginRequired(crowi, app, false) , page.pageListShowForCrowiPlus);
     app.get('/*'                     , loginRequired(crowi, app, false) , page.pageShowForCrowiPlus);
   }
   else {

+ 7 - 1
lib/routes/page.js

@@ -119,10 +119,16 @@ module.exports = function(crowi, app) {
     });
   };
 
-  actions.pageShowForCrowiPlus = function(req, res) {
+  actions.pageListShowForCrowiPlus = function(req, res) {
     var path = getPathFromRequest(req);
     // omit the slash of the last
     path = path.replace((/\/$/), '');
+    // redirect
+    return res.redirect(path);
+  }
+
+  actions.pageShowForCrowiPlus = function(req, res) {
+    var path = getPathFromRequest(req);
 
     var limit = 50;
     var offset = parseInt(req.query.offset)  || 0;