diff --git a/src/app/browser/proxy/ignore/row.rs b/src/app/browser/proxy/ignore/row.rs index 7e655f41..0c80e69e 100644 --- a/src/app/browser/proxy/ignore/row.rs +++ b/src/app/browser/proxy/ignore/row.rs @@ -138,7 +138,7 @@ pub fn new(on_add: impl Fn() + 'static) -> Box { .css_classes(["success"]) .hexpand(true) .icon_name("list-add-symbolic") - .tooltip_text("Add host exception") + .tooltip_text("Add hostname or IP exception") .build(); add.connect_clicked(move |_| on_add()); @@ -163,15 +163,16 @@ fn validate(host: &Entry) -> bool { } fn validate_host(value: &str) -> Result<(), String> { - match gtk::gio::InetAddress::from_string(value) { - Some(address) => { - if address.to_string() != value { - Err("Host could not be parsed properly".to_string()) + match gtk::gio::NetworkAddress::parse(value, 0) { + Ok(address) => { + use gtk::prelude::NetworkAddressExt; + if address.hostname() != value { + Err("Hostname or IP could not be parsed properly".to_string()) } else { Ok(()) } } - None => Err("Valid host is required".to_string()), + Err(e) => Err(format!("Valid hostname or IP is required: `{e}`")), } }