Browse Source

remove redirection when the page is empty

yohei0125 3 years ago
parent
commit
dd062a90d1
1 changed files with 3 additions and 8 deletions
  1. 3 8
      packages/app/src/server/routes/page.js

+ 3 - 8
packages/app/src/server/routes/page.js

@@ -428,14 +428,9 @@ module.exports = function(crowi, app) {
 
     // empty page
     if (page.isEmpty) {
-      // redirect to page (path) url
-      const url = new URL('https://dummy.origin');
-      url.pathname = page.path;
-      url.searchParams.append('originalEmptyPageId', page._id); // add this to distingish if user access the empty page intentionally
-      Object.entries(req.query).forEach(([key, value], i) => {
-        url.searchParams.append(key, value);
-      });
-      return res.safeRedirect(urljoin(url.pathname, url.search));
+      req.pageId = page._id;
+      req.pagePath = page.path;
+      return _notFound(req, res);
     }
 
     const { path } = page; // this must exist