From 67ad72b71591c7e1b40531daaae20cd5813556bc Mon Sep 17 00:00:00 2001 From: Jiwon Choi Date: Wed, 23 Oct 2024 15:01:27 +0900 Subject: [PATCH] fix: metadata image route normalize path posix for windows (#71673) ### Why? When handling the opengraph-image size exceeding the limit, we mapped with string literal between Rust and JavaScript. The Rust string literal contains backslashes `\` on Windows, incompatible with JavaScript string syntax. Following up on #71615. Fixes #71582 --- .../src/build/webpack/loaders/next-metadata-route-loader.ts | 2 ++ 1 file changed, 2 insertions(+) diff --git a/packages/next/src/build/webpack/loaders/next-metadata-route-loader.ts b/packages/next/src/build/webpack/loaders/next-metadata-route-loader.ts index f709ce018a9aa0..a3b71536555857 100644 --- a/packages/next/src/build/webpack/loaders/next-metadata-route-loader.ts +++ b/packages/next/src/build/webpack/loaders/next-metadata-route-loader.ts @@ -76,6 +76,8 @@ async function getStaticAssetRouteCode( resourcePath: string, fileBaseName: string ) { + resourcePath = path.posix.normalize(resourcePath) + const cache = fileBaseName === 'favicon' ? 'public, max-age=0, must-revalidate'