From 4c9a67ef0319cc2e0df8271504ba00dd91d0f36f Mon Sep 17 00:00:00 2001 From: Tyler Wilding Date: Mon, 7 Oct 2024 21:04:34 -0400 Subject: [PATCH] frontend: simplify the version pagination regex (#593) Fixes #586 Depending on your javascript engine, you may or may not have support for lookaheads/lookbehinds. I took this regex from github's examples without thinking -- probably fine in all versions of `node` but of course some platforms it's not going to work. Simplify it to be a more typical regex. --- src/lib/utils/github.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/lib/utils/github.ts b/src/lib/utils/github.ts index 999ca83..d59e51b 100644 --- a/src/lib/utils/github.ts +++ b/src/lib/utils/github.ts @@ -92,7 +92,7 @@ async function parseGithubRelease(githubRelease: any): Promise { } export async function listOfficialReleases(): Promise { - const nextUrlPattern = /(?<=<)([\S]*)(?=>; rel="Next")/i; + const nextUrlPattern = /<([\S]+)>; rel="Next"/i; let releases = []; let urlToHit = "https://api.github.com/repos/open-goal/jak-project/releases?per_page=100"; @@ -117,7 +117,7 @@ export async function listOfficialReleases(): Promise { resp.headers.get("link").includes(`rel=\"next\"`) ) { // we must paginate! - urlToHit = resp.headers.get("link").match(nextUrlPattern)[0]; + urlToHit = resp.headers.get("link").match(nextUrlPattern)[1]; } else { urlToHit = undefined; }