From 13f4be030a5e3701fa6a8efefea6c40ec22f1cf0 Mon Sep 17 00:00:00 2001 From: Chris Moran Date: Sat, 2 Dec 2023 10:06:06 -0500 Subject: [PATCH] fix: bad leading slash on empty basePath --- src/next-edge/index.ts | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/next-edge/index.ts b/src/next-edge/index.ts index 6390205..0915395 100644 --- a/src/next-edge/index.ts +++ b/src/next-edge/index.ts @@ -139,8 +139,12 @@ export function createApiHandler(options: CreateApiHandlerOptions) { const url = `${baseUrl}/${path}?${search.toString()}` const basePathNoLeadingSlash = basePath.length > 1 ? basePath.substring(1) : "" + const welcomeArray = + basePathNoLeadingSlash.length === 0 + ? ["ui", "welcome"] + : [basePathNoLeadingSlash, "ui", "welcome"] - if (path === `${[basePathNoLeadingSlash, "ui", "welcome"].join("/")}`) { + if (path === `${welcomeArray.join("/")}`) { // A special for redirecting to the home page // if we were being redirected to the hosted UI // welcome page.