From bbbfe486341bbcbe79b6e7e74a6dd326618515cd Mon Sep 17 00:00:00 2001 From: "Chuma Mcphoy (We Ahead)" Date: Tue, 4 Mar 2025 08:02:16 +0000 Subject: [PATCH] Merged in fix/SW-1801-return-not-found-on-non-existing-routes (pull request #1462) fix(SW-1801): Prevent resolving subpages for start page * fix(SW-1801): Prevent resolving subpages for start page Approved-by: Linus Flood --- apps/scandic-web/middlewares/cmsContent.ts | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/apps/scandic-web/middlewares/cmsContent.ts b/apps/scandic-web/middlewares/cmsContent.ts index 520b15ee4..855e7f9ac 100644 --- a/apps/scandic-web/middlewares/cmsContent.ts +++ b/apps/scandic-web/middlewares/cmsContent.ts @@ -43,6 +43,11 @@ export const middleware: NextMiddleware = async (request) => { contentType = parentContentType uid = parentUid switch (parentContentType) { + // If the parent is the startpage, we should not be able to resolve a subpage. + case PageContentTypeEnum.startPage: + throw notFound( + `Unable to resolve CMS entry for page "${pathWithoutTrailingSlash}"` + ) case PageContentTypeEnum.hotelPage: // E.g. Dedicated pages for restaurant, parking etc. searchParams.set("subpage", subpage)