From 1ae59fc64bdaae653b7b8489fd8eebbb8f711012 Mon Sep 17 00:00:00 2001 From: Mike Bostock Date: Wed, 27 Mar 2024 09:36:50 -0700 Subject: [PATCH] fix infinite normalize loop (#1155) --- src/preview.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/preview.ts b/src/preview.ts index b940af3d1..f8a9e2e34 100644 --- a/src/preview.ts +++ b/src/preview.ts @@ -172,7 +172,7 @@ export class PreviewServer { // Normalize the pathname (e.g., dropping ".html"). const normalizedPathname = config.md.normalizeLink(pathname); - if (pathname !== normalizedPathname) { + if (url.pathname !== normalizedPathname) { res.writeHead(302, {Location: normalizedPathname + url.search}); res.end(); return;