From 3a90988d810c3f73e25c18fe97633fd8bd1aa007 Mon Sep 17 00:00:00 2001 From: Ryan Blenis Date: Mon, 20 Apr 2020 12:24:07 -0400 Subject: [PATCH] Fix plugin version compare for new semver numbers --- pluginHandler.js | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/pluginHandler.js b/pluginHandler.js index 3d79c421..b095eb19 100644 --- a/pluginHandler.js +++ b/pluginHandler.js @@ -274,9 +274,8 @@ module.exports.pluginHandler = function (parent) { }) }; - // MeshCentral doesn't adhere to semantic versioning (due to the - at the end of the version) - // Convert 1.2.3-a to 1.2.3-3 where the letter is converted to a number. - obj.versionToNumber = function(ver) { var x = ver.split('-'); if (x.length != 2) return ver; x[1] = x[1].toLowerCase().charCodeAt(0) - 96; return x.join('.'); } + // MeshCentral now adheres to semver, drop the - off the version number for later versions for comparing plugins prior to this change + obj.versionToNumber = function(ver) { var x = ver.split('-'); if (x.length != 2) return ver; return x[0]; } // Check if the current version of MeshCentral is at least the minimal required. obj.versionCompare = function(current, minimal) {