MangaDex: use `matchEntire` to match UUID (#13600)

This commit is contained in:
stevenyomi 2022-09-27 22:27:48 +08:00 committed by GitHub
parent 2214d390a4
commit a062cfaeca
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 3 additions and 5 deletions

View File

@ -6,10 +6,8 @@ import java.util.TimeZone
object MDConstants {
const val UUID_REGEX = "[0-9a-f]{8}-[0-9a-f]{4}-[1-5][0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}"
val uuidRegex = UUID_REGEX.toRegex()
val onlyUuidRegex = "^$UUID_REGEX$".toRegex()
val uuidRegex =
Regex("[0-9a-f]{8}-[0-9a-f]{4}-[1-5][0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}")
const val mangaLimit = 20
const val latestChapterLimit = 100

View File

@ -68,7 +68,7 @@ class MangaDexHelper(private val lang: String) {
/**
* Check if the string is a valid uuid
*/
fun isUuid(text: String) = text.matches(MDConstants.onlyUuidRegex)
fun isUuid(text: String) = MDConstants.uuidRegex.matchEntire(text) != null
/**
* Get the manga offset pages are 1 based, so subtract 1