浏览代码

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
     }
 }