From c26290cd04799b884f9667b9cc21689d1a457ff3 Mon Sep 17 00:00:00 2001 From: Viorel Toader Date: Wed, 21 Oct 2026 11:13:57 +0300 Subject: [PATCH] Show form notes that contain a pipe as they are tr reads | as a context separator, so translating the Open Hyperlink note cut a URL with a pipe down to the part after it. Notes carry user data (URLs, file and sheet names); one with a pipe is now drawn verbatim. Co-Authored-By: Claude Opus 5.5 Claude-Session: https://claude.ai/code/session_01JadgGo4G2GHaAMNb3qyygk --- crates/ui-egui/src/dialogs.rs | 5 ++++- crates/ui-egui/tests/translated_form_fields.rs | 14 ++++++++++++++ 2 files changed, 18 insertions(+), 1 deletion(-) diff --git a/crates/ui-egui/src/dialogs.rs b/crates/ui-egui/src/dialogs.rs index 9dee2c886..b290117c4 100644 --- a/crates/ui-egui/src/dialogs.rs +++ b/crates/ui-egui/src/dialogs.rs @@ -1462,7 +1462,10 @@ fn form_fields(ui: &mut egui::Ui, d: &mut Dialog) { } } Field::Note(t) => { - ui.label(egui::RichText::new(lang.tr(&t)).small()); + // A note can carry user data (a URL, a file or sheet name); `tr` reads a `|` as a + // context separator, so such a note is shown as it is. + let text = if t.contains('|') { t.as_str() } else { lang.tr(&t) }; + ui.label(egui::RichText::new(text).small()); } } ui.end_row(); diff --git a/crates/ui-egui/tests/translated_form_fields.rs b/crates/ui-egui/tests/translated_form_fields.rs index 6c3bc93ca..35847a425 100644 --- a/crates/ui-egui/tests/translated_form_fields.rs +++ b/crates/ui-egui/tests/translated_form_fields.rs @@ -39,3 +39,17 @@ fn form_fields_are_translated() { } } } + +#[test] +fn notes_with_a_pipe_show_in_full() { + // `tr` reads `|` as a context separator; the Open Hyperlink note carries the URL, which must + // be shown whole so the user sees where the link really goes. + let url = "https://example.com/report|evil.example"; + for language in ["en", "pt"] { + let mut h = harness(); + h.state_mut().run("app.language.set", json!({"language": language})).unwrap(); + h.state_mut().open_dialog("openLink", json!({"url": url})); + h.run_steps(3); + assert!(h.query_by_label_contains(url).is_some(), "{language}: the link note lost part of {url}"); + } +}