Add check to preserve Next.js static assets in path normalization

This commit is contained in:
sudipnext 2026-03-18 13:06:48 +05:45
parent 55ec443309
commit 6433d2f66c

View file

@ -7,6 +7,12 @@ function normalizePathSeparators(value: string): string {
function toServedPath(rawPath: string): string {
const normalized = normalizePathSeparators(decodeURIComponent(rawPath));
// Never rewrite Next.js bundled/static assets.
// Example: /_next/static/media/*.svg should stay unchanged.
if (normalized.startsWith("/_next/static/")) {
return normalized;
}
// Prefer canonical FastAPI-mounted roots when present.
const appDataIdx = normalized.indexOf("/app_data/");
if (appDataIdx !== -1) {