Skip to content

Commit

Permalink
fix(prerender): check link's pathname only for extensions
Browse files Browse the repository at this point in the history
If a link contains parts following the pathname, e.g. a query or hash, the file extension would not be found. Links that appear to have no file extension would then NOT be excluded from crawling. Those included links led the crawler to request, e.g. static, files on which `vue-bundle-renderer` would produce a memory overflow.
  • Loading branch information
dargmuesli committed Dec 30, 2022
1 parent 064e194 commit f323256
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions src/prerender.ts
Original file line number Diff line number Diff line change
Expand Up @@ -276,6 +276,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] || "";
}

0 comments on commit f323256

Please sign in to comment.