Skip to content

Commit c2fc5f8

Browse files
authored
fix(server): prevent double redirect with root-level dynamic routes (#3866)
1 parent 2b58f94 commit c2fc5f8

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

src/runtime/server/plugin.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -155,7 +155,7 @@ export default defineNitroPlugin(async (nitro) => {
155155
const detector = useDetectors(event, detection)
156156
const localeSegment = detector.route(event.path)
157157
const pathLocale = (isSupportedLocale(localeSegment) && localeSegment) || undefined
158-
const path = (pathLocale && url.pathname.slice(pathLocale.length + 1)) || url.pathname
158+
const path = (pathLocale && url.pathname.slice(pathLocale.length + 1)) ?? url.pathname
159159

160160
// attempt to only run i18n detection for nuxt pages and i18n server routes
161161
if (!url.pathname.includes(__I18N_SERVER_ROUTE__) && !isExistingNuxtRoute(path)) {

0 commit comments

Comments
 (0)