Skip to content

Node.js based forum software built for the modern web

fix: check if latestversion is valid before using semver.gt

Barış Soner Uşaklı6fe066ced270
diff --git a/src/controllers/admin/dashboard.js b/src/controllers/admin/dashboard.js
index d3bf019443..aa173eca07 100644
--- a/src/controllers/admin/dashboard.js
+++ b/src/controllers/admin/dashboard.js
@@ -28,12 +28,13 @@ dashboardController.get = async function (req, res) {
getPopularSearches(),
]);
const version = nconf.get('version');
+ const latestValidVersion = semver.valid(latestVersion);
res.render('admin/dashboard', {
version: version,
- lookupFailed: latestVersion === null,
- latestVersion: latestVersion,
- upgradeAvailable: latestVersion && semver.gt(latestVersion, version),
+ lookupFailed: latestValidVersion === null,
+ latestVersion: latestValidVersion,
+ upgradeAvailable: latestValidVersion && semver.gt(latestValidVersion, version),
currentPrerelease: versions.isPrerelease.test(version),
notices: notices,
stats: stats,