From 57f6657468ea2be399d6f056e608a98cf6b3f85d Mon Sep 17 00:00:00 2001 From: Emanuele Stoppa Date: Mon, 7 Oct 2024 16:09:32 +0100 Subject: [PATCH] fix(routing): default locale when there's a list --- packages/astro/src/actions/runtime/middleware.ts | 2 -- packages/astro/src/i18n/utils.ts | 5 +---- 2 files changed, 1 insertion(+), 6 deletions(-) diff --git a/packages/astro/src/actions/runtime/middleware.ts b/packages/astro/src/actions/runtime/middleware.ts index a12a34c04f5cf..bca110652db58 100644 --- a/packages/astro/src/actions/runtime/middleware.ts +++ b/packages/astro/src/actions/runtime/middleware.ts @@ -133,11 +133,9 @@ async function redirectWithResult({ if (!referer) { throw new Error('Internal: Referer unexpectedly missing from Action POST request.'); } - console.log('redirect referer', referer); return context.redirect(referer); } - console.log('normal redirect', context.url.pathname); return context.redirect(context.url.pathname); } diff --git a/packages/astro/src/i18n/utils.ts b/packages/astro/src/i18n/utils.ts index 496370a6bc71d..c79c66612d342 100644 --- a/packages/astro/src/i18n/utils.ts +++ b/packages/astro/src/i18n/utils.ts @@ -164,10 +164,7 @@ export function computeCurrentLocale( } } else { if (locale.path === segment) { - const result = locale.codes.at(0); - if (result) { - return result; - } + return locale.codes.at(0); } else { for (const code of locale.codes) { if (normalizeTheLocale(code) === normalizeTheLocale(segment)) {