commit 2539463

delthas  ·  2025-08-23 13:01:45 +0000 UTC
parent 664fe0e
Support IPv6 zone identifiers in address

We previously supported them in their URL-encoded form, but this
was not intuitive. Also support them if passed unencoded.

Thanks to socksinspace for finding this issue.
1 files changed,  +6, -0
+6, -0
 1@@ -175,6 +175,12 @@ func ParseAddr(addr string, cfg *Config) error {
 2 		addr = "irc://" + addr
 3 	}
 4 	u, err := url.Parse(addr)
 5+	if err != nil && strings.Contains(addr, "%") && !strings.Contains(addr, "%25") {
 6+		// Escape any unescaped IPv6 zone identifiers, since it is not intuitive that they should be escaped,
 7+		// especially when no scheme is provided.
 8+		addr = strings.ReplaceAll(addr, "%", "%25")
 9+		u, err = url.Parse(addr)
10+	}
11 	if err != nil {
12 		return err
13 	}