diff --git a/src/updates.js b/src/updates.js index 4839db28..90383539 100644 --- a/src/updates.js +++ b/src/updates.js @@ -226,8 +226,12 @@ class Updates { const body = await rres.text(); const matches = body.match(/[^ ]*\.nupkg/gim); assert(matches); - const nuPKG = rurl.replace("RELEASES", matches[0]); - latest[key].RELEASES = body.replace(matches[0], nuPKG); + let RELEASES = body; + for (const match of matches) { + const nuPKG = rurl.replace("RELEASES", match); + RELEASES = RELEASES.replace(match, nuPKG); + } + latest[key].RELEASES = RELEASES; } } } diff --git a/test/update.test.js b/test/update.test.js index 7857a0c8..f5d382dc 100644 --- a/test/update.test.js +++ b/test/update.test.js @@ -149,7 +149,7 @@ nock("https://api.github.com") nock("https://github.com") .get("/owner/repo/releases/download/1.0.0/RELEASES") .times(3) - .reply(200, "HASH name.nupkg NUMBER") + .reply(200, "HASH name.nupkg NUMBER\nHASH2 name2.nupkg NUMBER2") .get("/owner/repo-with-v/releases/download/v1.0.0/RELEASES") .reply(404) .get("/owner/repo-darwin/releases/download/v1.0.0/RELEASES") @@ -361,7 +361,7 @@ test("Updates", async (t) => { const body = await res.text(); t.match( body, - /^[^ ]+ https:\/\/github.com\/owner\/repo\/releases\/download\/[^/]+\/name.nupkg [^ ]+$/ + /^[^ ]+ https:\/\/github.com\/owner\/repo\/releases\/download\/[^/]+\/name.nupkg [^ ]+\n[^ ]+ https:\/\/github.com\/owner\/repo\/releases\/download\/[^/]+\/name2.nupkg [^ ]+$/ ); } @@ -373,7 +373,7 @@ test("Updates", async (t) => { const body = await res.text(); t.match( body, - /^[^ ]+ https:\/\/github.com\/owner\/repo\/releases\/download\/[^/]+\/name.nupkg [^ ]+$/ + /^[^ ]+ https:\/\/github.com\/owner\/repo\/releases\/download\/[^/]+\/name.nupkg [^ ]+\n[^ ]+ https:\/\/github.com\/owner\/repo\/releases\/download\/[^/]+\/name2.nupkg [^ ]+$/ ); } }); @@ -387,7 +387,7 @@ test("Updates", async (t) => { const body = await res.text(); t.match( body, - /^[^ ]+ https:\/\/github.com\/owner\/repo\/releases\/download\/[^/]+\/name.nupkg [^ ]+$/ + /^[^ ]+ https:\/\/github.com\/owner\/repo\/releases\/download\/[^/]+\/name.nupkg [^ ]+\n[^ ]+ https:\/\/github.com\/owner\/repo\/releases\/download\/[^/]+\/name2.nupkg [^ ]+$/ ); } });