mirror of
https://github.com/packwiz/packwiz.git
synced 2025-04-19 21:16:30 +02:00
Fix pre-release and release candidate version checking
This commit is contained in:
parent
da779d55cd
commit
d789066039
@ -31,18 +31,14 @@ var fileIDRegexes = [...]*regexp.Regexp{
|
|||||||
|
|
||||||
var snapshotVersionRegex = regexp.MustCompile("(?:Snapshot )?(\\d+)w0?(0|[1-9]\\d*)([a-z])")
|
var snapshotVersionRegex = regexp.MustCompile("(?:Snapshot )?(\\d+)w0?(0|[1-9]\\d*)([a-z])")
|
||||||
|
|
||||||
|
var snapshotNames = [...]string{"-pre", " Pre-Release ", " Pre-release ", "-rc"}
|
||||||
|
|
||||||
func getCurseforgeVersion(mcVersion string) string {
|
func getCurseforgeVersion(mcVersion string) string {
|
||||||
if strings.HasSuffix(mcVersion, "-pre") {
|
for _, name := range snapshotNames {
|
||||||
return strings.TrimSuffix(mcVersion, "-pre") + "-Snapshot"
|
index := strings.Index(mcVersion, name)
|
||||||
}
|
|
||||||
// Mojang why must it be this way
|
|
||||||
index := strings.Index(mcVersion, " Pre-Release ")
|
|
||||||
if index > -1 {
|
if index > -1 {
|
||||||
return mcVersion[:index] + "-Snapshot"
|
return mcVersion[:index] + "-Snapshot"
|
||||||
}
|
}
|
||||||
index = strings.Index(mcVersion, " Pre-release ")
|
|
||||||
if index > -1 {
|
|
||||||
return mcVersion[:index] + "-Snapshot"
|
|
||||||
}
|
}
|
||||||
|
|
||||||
matches := snapshotVersionRegex.FindStringSubmatch(mcVersion)
|
matches := snapshotVersionRegex.FindStringSubmatch(mcVersion)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user