From 6585e8dec9ae8b6f1a6ca643334d8a9af1395af5 Mon Sep 17 00:00:00 2001 From: Jonas Thelemann Date: Fri, 13 Jan 2023 17:21:29 +0100 Subject: [PATCH] fix(prerender): check link's pathname only for extensions (#791) --- src/prerender.ts | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/prerender.ts b/src/prerender.ts index d237bd9ad2..781e0942b7 100644 --- a/src/prerender.ts +++ b/src/prerender.ts @@ -281,6 +281,7 @@ function extractLinks( const EXT_REGEX = /\.[\da-z]+$/; -function getExtension(path: string): string { - return (path.match(EXT_REGEX) || [])[0] || ""; +function getExtension(link: string): string { + const pathname = parseURL(link).pathname; + return (pathname.match(EXT_REGEX) || [])[0] || ""; }