mirror of
https://github.com/pppscn/SmsForwarder
synced 2024-11-08 01:10:23 +00:00
优化:检查合法的URL时支持IPv6地址(例如:主动控制·客户端的服务地址)
This commit is contained in:
parent
35151aa924
commit
c2ab087155
@ -36,7 +36,6 @@ import com.xuexiang.xui.widget.dialog.materialdialog.DialogAction
|
||||
import com.xuexiang.xui.widget.dialog.materialdialog.MaterialDialog
|
||||
import com.xuexiang.xutil.XUtil
|
||||
|
||||
|
||||
@Suppress("PrivatePropertyName", "PropertyName")
|
||||
@Page(name = "主动控制·客户端")
|
||||
class ClientFragment : BaseFragment<FragmentClientBinding?>(),
|
||||
|
@ -243,7 +243,7 @@ class CommonUtils private constructor() {
|
||||
//是否合法的url
|
||||
fun checkUrl(urls: String?, emptyResult: Boolean): Boolean {
|
||||
if (TextUtils.isEmpty(urls)) return emptyResult
|
||||
val regex = "^(https?|ftp|file)://[-a-zA-Z0-9+&@#/%?=~_|!:,.;]*[-a-zA-Z0-9+&@#/%=~_|]"
|
||||
val regex = "^(https?|ftp|file)://[-a-zA-Z0-9+&@#/%?=~_|!:,.;\\[\\]]*[-a-zA-Z0-9+&@#/%=~_|\\[\\]]"
|
||||
val pat = Pattern.compile(regex)
|
||||
val mat = pat.matcher(urls?.trim() ?: "")
|
||||
return mat.matches()
|
||||
|
Loading…
Reference in New Issue
Block a user