From b15b859cf636ba08abd44dcfb3d4b08e2e7fa0a4 Mon Sep 17 00:00:00 2001 From: Tony <68118705+Legend-Master@users.noreply.github.com> Date: Thu, 14 May 2026 12:33:17 +0800 Subject: [PATCH] refactor: make error dialog take `&'static str` (#15369) * refactor: make error dialog take `&'static str` * Add comments --- crates/tauri-runtime-wry/src/dialog/mod.rs | 4 +++- crates/tauri-runtime-wry/src/dialog/windows.rs | 4 ++-- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/crates/tauri-runtime-wry/src/dialog/mod.rs b/crates/tauri-runtime-wry/src/dialog/mod.rs index 156d6a6d2a4c..3befa7b8a0bf 100644 --- a/crates/tauri-runtime-wry/src/dialog/mod.rs +++ b/crates/tauri-runtime-wry/src/dialog/mod.rs @@ -5,7 +5,9 @@ #[cfg(windows)] mod windows; -pub fn error>(err: S) { +// Takes a `&'static str` here since we convert clickable hyperlinks, +// DO NOT pass in untrusted input +pub fn error(err: &'static str) { #[cfg(windows)] windows::error(err); diff --git a/crates/tauri-runtime-wry/src/dialog/windows.rs b/crates/tauri-runtime-wry/src/dialog/windows.rs index 2f520c563723..0f9b2c2a65e1 100644 --- a/crates/tauri-runtime-wry/src/dialog/windows.rs +++ b/crates/tauri-runtime-wry/src/dialog/windows.rs @@ -12,8 +12,8 @@ enum Level { Info, } -pub fn error>(err: S) { - dialog_inner(err.as_ref(), Level::Error); +pub fn error(err: &'static str) { + dialog_inner(err, Level::Error); } fn dialog_inner(err: &str, level: Level) {