소스 검색

fix 不允许输入错误的端口号

robin 4 년 전
부모
커밋
c7c0562e4b
1개의 변경된 파일1개의 추가작업 그리고 1개의 파일을 삭제
  1. 1 1
      app/src/main/java/com/doverfuelingsolutions/issp/utils/ValidateUtil.kt

+ 1 - 1
app/src/main/java/com/doverfuelingsolutions/issp/utils/ValidateUtil.kt

@@ -13,6 +13,6 @@ class ValidateUtil {
         fun isPositiveInt(num: String): Boolean = regexPositiveInt.matches(num)
         fun isUrl(url: String): Boolean = regexUrl.matches(url)
         fun isIPHost(url: String): Boolean = regexIPHost.matches(url)
-        fun isPort(port: String): Boolean = isPositiveInt(port) && port.toInt() < 65535
+        fun isPort(port: String): Boolean = isPositiveInt(port) && port.length < 6 && port.toInt() < 65535
     }
 }