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.
This commit is contained in:
Tyler Wilding 2024-10-07 21:04:34 -04:00 committed by GitHub
parent 12b81da339
commit 4c9a67ef03
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -92,7 +92,7 @@ async function parseGithubRelease(githubRelease: any): Promise<ReleaseInfo> {
}
export async function listOfficialReleases(): Promise<ReleaseInfo[]> {
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<ReleaseInfo[]> {
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;
}