From 0d6bbf7b7843c0c1ce80473b18105d237b766504 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Joakim=20J=C3=A4derberg?= Date: Wed, 19 Feb 2025 14:28:10 +0000 Subject: [PATCH] Merged in fix/get-from-contentstack (pull request #1378) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * fix: include lang when fetching from contentstack Approved-by: Matilda Landström --- middlewares/cmsContent.ts | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/middlewares/cmsContent.ts b/middlewares/cmsContent.ts index a5615f3b2..166098679 100644 --- a/middlewares/cmsContent.ts +++ b/middlewares/cmsContent.ts @@ -26,14 +26,15 @@ export const middleware: NextMiddleware = async (request) => { ? contentTypePathName.replace("/preview", "") : contentTypePathName - let { contentType, uid } = await getUidAndContentTypeByPath(incomingPathName) + let { contentType, uid } = await getUidAndContentTypeByPath( + pathWithoutTrailingSlash + ) const searchParams = new URLSearchParams(request.nextUrl.searchParams) if (!contentType || !uid) { // Routes to subpages we need to check if the parent of the incomingPathName exists. // Then we considered the incomingPathName to be a subpage. These subpages do not live in the CMS. - const incomingPathNameParts = incomingPathName.split("/") // If the incomingPathName has 2 or more parts, it could possibly be a subpage.