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

Fix: encodeURI when the portal exists

Sotaro KARASAWA 9 лет назад
Родитель
Сommit
d01fe87320
1 измененных файлов с 5 добавлено и 1 удалено
  1. 5 1
      lib/routes/page.js

+ 5 - 1
lib/routes/page.js

@@ -93,6 +93,8 @@ module.exports = function(crowi, app) {
       renderVars.pager = generatePager(pagerOptions);
       renderVars.pages = pageList;
       res.render('page_list', renderVars);
+    }).catch(function(err) {
+      debug('Error on rendering pageListShow', err);
     });
   };
 
@@ -202,11 +204,13 @@ module.exports = function(crowi, app) {
       Page.hasPortalPage(path + '/', req.user)
       .then(function(page) {
         if (page) {
-          return res.redirect(path + '/');
+          return res.redirect(encodeURI(path) + '/');
         } else {
           debug('Catch pageShow', err);
           return renderPage(null, req, res);
         }
+      }).catch(function(err) {
+        debug('Error on rendering pageShow (redirect to portal)', err);
       });
     });
   };