diff --git a/packages/runtime/src/helpers/utils.ts b/packages/runtime/src/helpers/utils.ts index c47ec1be71..2022fc6b00 100644 --- a/packages/runtime/src/helpers/utils.ts +++ b/packages/runtime/src/helpers/utils.ts @@ -74,7 +74,7 @@ export const generateNetlifyRoutes = ({ }) => [...(withData ? toNetlifyRoute(dataRoute) : []), ...toNetlifyRoute(route)] export const routeToDataRoute = (route: string, buildId: string, locale?: string) => - `/_next/data/${buildId}${locale ? `/${locale}` : ''}${route === '/' ? '/index' : route}.json` + `/_next/data/${buildId}${locale ? `/${locale}` : ''}${route === '/' ? (locale ? '' : '/index') : route}.json` // Default locale is served from root, not localized export const localizeRoute = (route: string, locale: string, defaultLocale: string) => diff --git a/test/__snapshots__/index.spec.js.snap b/test/__snapshots__/index.spec.js.snap index c45ce6cf80..bcc1c998a3 100644 --- a/test/__snapshots__/index.spec.js.snap +++ b/test/__snapshots__/index.spec.js.snap @@ -658,6 +658,12 @@ Array [ "status": 200, "to": "/.netlify/builders/_ipx", }, + Object { + "force": true, + "from": "/_next/data/build-id/en.json", + "status": 200, + "to": "/.netlify/builders/___netlify-odb-handler", + }, Object { "force": false, "from": "/_next/data/build-id/en/500.json", @@ -844,12 +850,6 @@ Array [ "status": 200, "to": "/.netlify/functions/___netlify-handler", }, - Object { - "force": true, - "from": "/_next/data/build-id/en/index.json", - "status": 200, - "to": "/.netlify/builders/___netlify-odb-handler", - }, Object { "force": false, "from": "/_next/data/build-id/en/layouts.json",