From 2929bb6dbabbcd337753febc0c69d0055c5c08f4 Mon Sep 17 00:00:00 2001 From: Ludovic Marie <136255825+ludovic111@users.noreply.github.com> Date: Mon, 26 Oct 2026 22:00:23 +0100 Subject: [PATCH] open_url: accept the http and https schemes in any case Util.parseAndValidateUntrustedUri lowercases the scheme before checking it. Co-Authored-By: Claude Opus 5.5 --- crates/horizon-client/src/component.rs | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/crates/horizon-client/src/component.rs b/crates/horizon-client/src/component.rs index cfb15bf0d..64d79f274 100644 --- a/crates/horizon-client/src/component.rs +++ b/crates/horizon-client/src/component.rs @@ -173,9 +173,14 @@ fn object_style(o: &serde_json::Map) -> Style { if let Some(e) = o.get("click_event").and_then(Value::as_object) { let text = |k: &str| e.get(k).and_then(Value::as_str).map(str::to_owned); style.click = match e.get("action").and_then(Value::as_str) { - // ClickEvent.OpenUrl.CODEC: ExtraCodecs.UNTRUSTED_URI allows http and https only. + // ClickEvent.OpenUrl.CODEC: ExtraCodecs.UNTRUSTED_URI allows http and + // https only, the scheme in any case (Util.parseAndValidateUntrustedUri). Some("open_url") => text("url") - .filter(|u| u.starts_with("http://") || u.starts_with("https://")) + .filter(|u| { + u.split_once(':').is_some_and(|(scheme, _)| { + scheme.eq_ignore_ascii_case("http") || scheme.eq_ignore_ascii_case("https") + }) + }) .map(crate::text::ClickEvent::OpenUrl), // ClickEvent.ChangePage.CODEC: ExtraCodecs.POSITIVE_INT. Some("change_page") => e