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

remove redirectOperationForSinglePage

yohei0125 3 лет назад
Родитель
Сommit
5af40f6a20
1 измененных файлов с 7 добавлено и 13 удалено
  1. 7 13
      packages/app/src/server/routes/page.js

+ 7 - 13
packages/app/src/server/routes/page.js

@@ -594,18 +594,6 @@ module.exports = function(crowi, app) {
     res.render('layout-growi/page_list', renderVars);
   };
 
-  /**
-   * Redirect process for single non-empty page
-   */
-  async function redirectOperationForSinglePage(page, req, res) {
-    const url = new URL('https://dummy.origin');
-    url.pathname = `/${page._id}`;
-    Object.entries(req.query).forEach(([key, value], i) => {
-      url.searchParams.append(key, value);
-    });
-    return res.safeRedirect(urljoin(url.pathname, url.search));
-  }
-
   /**
    * redirector
    */
@@ -631,7 +619,13 @@ module.exports = function(crowi, app) {
 
     if (nonEmptyPages.length === 1) {
       const nonEmptyPage = nonEmptyPages[0];
-      return redirectOperationForSinglePage(nonEmptyPage, req, res);
+      const url = new URL('https://dummy.origin');
+
+      url.pathname = `/${nonEmptyPage._id}`;
+      Object.entries(req.query).forEach(([key, value], i) => {
+        url.searchParams.append(key, value);
+      });
+      return res.safeRedirect(urljoin(url.pathname, url.search));
     }
 
     // Processing of nonEmptyPage is finished by the time this code is read