Skip to content

Commit

Permalink
frontend: simplify the version pagination regex (#593)
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
xTVaser authored Oct 8, 2024
1 parent 12b81da commit 4c9a67e
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/lib/utils/github.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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";
Expand All @@ -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];

This comment has been minimized.

Copy link
@trippjoe

trippjoe Oct 8, 2024

Member

whats going on here?

} else {
urlToHit = undefined;
}
Expand Down

0 comments on commit 4c9a67e

Please sign in to comment.