2
0
Эх сурвалжийг харах

Improved render variables

Taichi Masuyama 4 жил өмнө
parent
commit
b7dacbb6ea

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

@@ -564,12 +564,14 @@ module.exports = function(crowi, app) {
    */
   async function redirector(req, res, next, path) {
     const pages = await Page.findByPathAndViewer(path, req.user, null, false);
+    const { redirectFrom } = req.query;
 
     if (pages.length >= 2) {
-      // WIP
-      return res.render('layout-growi/select-go-to-page', { pages, query: req.query });
+      // pass only redirectFrom since it is not sure whether the query params are related to the pages
+      return res.render('layout-growi/select-go-to-page', { pages, redirectFrom });
     }
 
+    // pass all query params
     let query = '';
     Object.entries(req.query).forEach(([key, value], i) => {
       query += i === 0 ? `?${key}=${value}` : `&${key}=${value}`;