diff --git a/src/routes/releases.js b/src/routes/releases.js index e152a4c..9f77114 100644 --- a/src/routes/releases.js +++ b/src/routes/releases.js @@ -78,13 +78,16 @@ router.get( const releases = await getReleasesOrUpdate(); const { page, limit, version } = req.query; const releasesFromChannel = releases.filter(filter); - const major = Number(version); + let major = parseInt(version, 10); + if (isNaN(major) || major < 0) { + major = null; + } const majors = releasesFromChannel.reduce((acc, val) => { acc.add(semver.major(val.version)); return acc; }, new Set()); const releasesFromMajor = releasesFromChannel.filter((release) => { - if (Number.isInteger(major) && major >= 0) { + if (major) { return semver.major(release.version) === major; } else { return true; diff --git a/src/views/releases.handlebars b/src/views/releases.handlebars index dc4160d..29320c1 100644 --- a/src/views/releases.handlebars +++ b/src/views/releases.handlebars @@ -3,19 +3,19 @@