fix(utils): harden panic-prone paths (#2113)

Signed-off-by: houseme <housemecn@gmail.com>
Co-authored-by: houseme <housemecn@gmail.com>
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Co-authored-by: heihutu <30542132+heihutu@users.noreply.github.com>
This commit is contained in:
安正超
2026-03-11 15:16:03 +08:00
committed by GitHub
parent 9908a44c38
commit 7d7e0b2654
3 changed files with 63 additions and 12 deletions
+2 -2
View File
@@ -200,8 +200,8 @@ impl std::fmt::Display for ParsedURL {
&& let Some(port) = url.port()
&& ((url.scheme() == "http" && port == 80) || (url.scheme() == "https" && port == 443))
{
url.set_host(Some(&host)).unwrap();
url.set_port(None).unwrap();
let _ = url.set_host(Some(&host));
let _ = url.set_port(None);
}
let mut s = url.to_string();