mirror of
https://github.com/erlef/setup-beam.git
synced 2026-07-22 22:56:07 +00:00
Match only on what we know should match (versions start with numbers, after OTP-) (#341)
This commit is contained in:
committed by
GitHub
parent
db4b4ce7c5
commit
afe592256a
Vendored
+8
-4
@@ -26067,9 +26067,13 @@ function requestedVersionFor(tool, version, originListing, mirrors) {
|
||||
)
|
||||
}
|
||||
|
||||
const knownBranches = ['main', 'master', 'maint']
|
||||
const nonSpecificVersions = ['nightly', 'latest']
|
||||
|
||||
async function getElixirVersion(exSpec0, otpVersion0) {
|
||||
const otpVersion = otpVersion0.match(/^(?:OTP-)?(.+)$/)[1]
|
||||
let otpVersionMajor = otpVersion.match(/^([^.]+).*$/)[1]
|
||||
const regex = `^(\\d{1,3}|${knownBranches.join('|')}|${nonSpecificVersions.join('|')})?.*$`
|
||||
let otpVersionMajor = otpVersion.match(new RegExp(regex))[1]
|
||||
|
||||
const otpSuffix = /-otp-(\d+)/
|
||||
const userSuppliedOtp = exSpec0.match(otpSuffix)?.[1] ?? null
|
||||
@@ -26316,7 +26320,9 @@ function gt(left, right) {
|
||||
|
||||
function validVersion(v) {
|
||||
return (
|
||||
v.match(/main|master|nightly|latest/g) == null &&
|
||||
v.match(
|
||||
new RegExp(`${knownBranches.join('|')}|${nonSpecificVersions.join('|')}`),
|
||||
) == null &&
|
||||
!v.startsWith('a') &&
|
||||
!v.startsWith('b')
|
||||
)
|
||||
@@ -26435,8 +26441,6 @@ function isRC(ver) {
|
||||
return ver.match(xyzAbcVersion('^', '(?:-rc\\.?\\d+)'))
|
||||
}
|
||||
|
||||
const knownBranches = ['main', 'master', 'maint']
|
||||
|
||||
function isKnownBranch(ver) {
|
||||
return knownBranches.includes(ver)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user