Fix nightly version name parsing

This commit is contained in:
Koitharu
2024-11-07 14:47:52 +02:00
parent 11212ed071
commit cdce2af4a3
2 changed files with 4 additions and 1 deletions

View File

@@ -1,5 +1,6 @@
package org.koitharu.kotatsu.core.github
import org.koitharu.kotatsu.core.util.ext.digits
import java.util.Locale
data class VersionId(
@@ -48,7 +49,7 @@ fun VersionId(versionName: String): VersionId {
return VersionId(
major = 0,
minor = 0,
build = versionName.drop(1).toIntOrNull() ?: 0,
build = versionName.digits().toIntOrNull() ?: 0,
variantType = "n",
variantNumber = 0,
)

View File

@@ -28,6 +28,8 @@ fun String.toUUIDOrNull(): UUID? = try {
null
}
fun String.digits() = filter { it.isDigit() }
/**
* @param threshold 0 = exact match
*/