Use IPEndPoint to avoid potential URL with IP ports

This commit is contained in:
VictoriousRaptor 2026-03-01 14:20:28 +08:00
parent f6ca3c850b
commit 74c18d8195

View file

@ -116,8 +116,8 @@ namespace Flow.Launcher.Plugin.Url
return true;
// Valid IP address (excluding 0.0.0.0)
if (IPAddress.TryParse(host, out var hostIp))
return !hostIp.Equals(IPAddress.Any) && !hostIp.Equals(IPAddress.IPv6Any);
if (IPEndPoint.TryParse(host, out endpoint))
return !endpoint.Address.Equals(IPAddress.Any) && !endpoint.Address.Equals(IPAddress.IPv6Any);
// Domain must have valid format with TLD
var parts = host.Split('.');