From b51b8aabb5efe018db4706080035362967caa885 Mon Sep 17 00:00:00 2001 From: Duane Johnson Date: Tue, 10 Jan 2023 20:54:06 -0700 Subject: [PATCH] fix: allow web plugin to xdg-open custom URI schemes #154 --- plugins/src/web/mod.rs | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/plugins/src/web/mod.rs b/plugins/src/web/mod.rs index ef51dca..e4e8249 100644 --- a/plugins/src/web/mod.rs +++ b/plugins/src/web/mod.rs @@ -199,7 +199,9 @@ impl App { fn build_query(definition: &Definition, query: &str) -> String { let q = definition.query.as_str(); - let prefix = if q.starts_with("https://") || q.starts_with("http://") { + let scheme_regex = Regex::new(r"^([a-zA-Z]+[a-zA-Z0-9\+\-\.]*):").unwrap(); + + let prefix = if scheme_regex.is_match(q) { "" } else { "https://"