@@ -83,9 +83,9 @@ public bool IsURL(string raw)
8383 if ( decimal . TryParse ( input , out _ ) )
8484 return false ;
8585
86- // Check if it's a bare IP address with optional port and path
87- var ipPart = input . Split ( '/' ) [ 0 ] ; // Remove path
88- if ( IPEndPoint . TryParse ( ipPart , out var endpoint ) && ! endpoint . Address . Equals ( IPAddress . Any ) )
86+ // Check if it's a bare IP address with optional port, path, query, or fragment
87+ var ipPart = input . Split ( '/' , '?' , '#' ) [ 0 ] ; // Remove path, query, and fragment
88+ if ( IPEndPoint . TryParse ( ipPart , out var endpoint ) && ! endpoint . Address . Equals ( IPAddress . Any ) && ! endpoint . Address . Equals ( IPAddress . IPv6Any ) )
8989 return true ;
9090
9191 // Add protocol if missing for Uri validation
@@ -108,16 +108,16 @@ public bool IsURL(string raw)
108108
109109 // Valid IP address (excluding 0.0.0.0)
110110 if ( IPAddress . TryParse ( host , out var hostIp ) )
111- return ! hostIp . Equals ( IPAddress . Any ) ;
111+ return ! hostIp . Equals ( IPAddress . Any ) && ! hostIp . Equals ( IPAddress . IPv6Any ) ;
112112
113113 // Domain must have valid format with TLD
114114 var parts = host . Split ( '.' ) ;
115115 if ( parts . Length < 2 || parts . Any ( string . IsNullOrEmpty ) )
116116 return false ;
117117
118- // TLD must be at least 2 letters
118+ // TLD must be at least 2 characters, allowing letters and digits
119119 var tld = parts [ ^ 1 ] ;
120- return tld . Length >= 2 && tld . All ( char . IsLetter ) ;
120+ return tld . Length >= 2 && tld . All ( char . IsLetterOrDigit ) ;
121121 }
122122
123123 public void Init ( PluginInitContext context )
0 commit comments