From b9271d72a182839eadc49e0c32d2beb64f1da37b Mon Sep 17 00:00:00 2001 From: Ahad Birang Date: Mon, 11 Apr 2022 22:10:41 +0200 Subject: [PATCH] fix(prerender): use pathname from extracted links only (#74) --- src/prerender.ts | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/prerender.ts b/src/prerender.ts index 65c6c71545..dc678aed3a 100644 --- a/src/prerender.ts +++ b/src/prerender.ts @@ -1,4 +1,5 @@ import { resolve, relative, join } from 'pathe' +import { parseURL } from 'ufo' import { createNitro } from './nitro' import { build } from './build' import type { Nitro } from './types' @@ -79,7 +80,7 @@ const LINK_REGEX = /href=['"]?([^'" >]+)/g function extractLinks (html: string, _url: string) { const links: string[] = [] for (const match of html.matchAll(LINK_REGEX)) { - links.push(match[1]) + links.push(parseURL(match[1]).pathname) } return links }