Skip to content
This repository has been archived by the owner on Jul 18, 2023. It is now read-only.

fix: broken version check #273

Merged
merged 1 commit into from
Aug 20, 2022
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 7 additions & 2 deletions wsEvents/GetAppVersion.js
Original file line number Diff line number Diff line change
Expand Up @@ -140,11 +140,16 @@ module.exports = async function (message, ws) {
beta: !!versionName.split(' ')[1]
});
}
const sanitizeVersion = (ver) => {
return ver
.replace(/\.0(?<digit>\d)/gi, '.$1') // because apparently x.0y.z (ex. 5.09.51) isn't a valid version
.replace(/^(?<version>\d+)\.(?<minor>\d+)$/gi, "$1.$2.0") // nor are versions without a patch (ex. 2.3)
}
versionList.sort(
(a, b) =>
lt(
a.version.replace(/\.0(?<digit>\d)/gi, '.$1'), // because apparently x.0y.z (ex. 5.09.51) isn't a valid version
b.version.replace(/\.0(?<digit>\d)/gi, '.$1')
sanitizeVersion(a.version),
sanitizeVersion(b.version)
)
? 1
: -1 /* yes i need to add this to the end, the sort function is stupid */
Expand Down