From 73cc5a91bc75e8d57a5bfd0ed50f35aab5cdd849 Mon Sep 17 00:00:00 2001 From: VictoriousRaptor <10308169+VictoriousRaptor@users.noreply.github.com> Date: Thu, 26 Feb 2026 14:26:20 +0800 Subject: [PATCH] Fix ipv6 any address and numeric TLD Co-authored-by: cubic-dev-ai[bot] <191113872+cubic-dev-ai[bot]@users.noreply.github.com> Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com> --- Plugins/Flow.Launcher.Plugin.Url/Main.cs | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/Plugins/Flow.Launcher.Plugin.Url/Main.cs b/Plugins/Flow.Launcher.Plugin.Url/Main.cs index 326bb4a30..5232a00ff 100644 --- a/Plugins/Flow.Launcher.Plugin.Url/Main.cs +++ b/Plugins/Flow.Launcher.Plugin.Url/Main.cs @@ -83,9 +83,9 @@ namespace Flow.Launcher.Plugin.Url if (decimal.TryParse(input, out _)) return false; - // Check if it's a bare IP address with optional port and path - var ipPart = input.Split('/')[0]; // Remove path - if (IPEndPoint.TryParse(ipPart, out var endpoint) && !endpoint.Address.Equals(IPAddress.Any)) + // Check if it's a bare IP address with optional port, path, query, or fragment + var ipPart = input.Split('/', '?', '#')[0]; // Remove path, query, and fragment + if (IPEndPoint.TryParse(ipPart, out var endpoint) && !endpoint.Address.Equals(IPAddress.Any) && !endpoint.Address.Equals(IPAddress.IPv6Any)) return true; // Add protocol if missing for Uri validation @@ -108,16 +108,16 @@ namespace Flow.Launcher.Plugin.Url // Valid IP address (excluding 0.0.0.0) if (IPAddress.TryParse(host, out var hostIp)) - return !hostIp.Equals(IPAddress.Any); + return !hostIp.Equals(IPAddress.Any) && !hostIp.Equals(IPAddress.IPv6Any); // Domain must have valid format with TLD var parts = host.Split('.'); if (parts.Length < 2 || parts.Any(string.IsNullOrEmpty)) return false; - // TLD must be at least 2 letters + // TLD must be at least 2 characters, allowing letters and digits var tld = parts[^1]; - return tld.Length >= 2 && tld.All(char.IsLetter); + return tld.Length >= 2 && tld.All(char.IsLetterOrDigit); } public void Init(PluginInitContext context)