Skip to content

Commit

Permalink
Add safety check when requesting GitHub resources
Browse files Browse the repository at this point in the history
  • Loading branch information
confused-Techie committed Jan 31, 2024
1 parent 030335c commit ad50a2a
Showing 1 changed file with 11 additions and 0 deletions.
11 changes: 11 additions & 0 deletions microservices/download/utils.js
Original file line number Diff line number Diff line change
Expand Up @@ -110,6 +110,17 @@ async function findLink(os, type) {

let releases = await doRequest();

if (!Array.isArray(releases)) {
console.error("GitHub Returned invalid data on release request!");
console.error(releases);

return {
ok: false,
code: 500,
msg: "Request to GitHub for releases failed."
};
}

// Now these releases should be sorted already, if we find they aren't we might
// have to add semver as a dep on this microservice, which is no fun since this
// microservice has 0 deps currently. For now lets assume it's a sorted array
Expand Down

0 comments on commit ad50a2a

Please sign in to comment.