From 0d39ff6b09e0a58a2e031d60f7bdc92b48d3cdf0 Mon Sep 17 00:00:00 2001 From: Tony <68118705+Legend-Master@users.noreply.github.com> Date: Sun, 13 Apr 2025 08:03:19 +0800 Subject: [PATCH] fix(core): missing `core:` in referenced commands (#13150) --- .changes/fix-referencing-command.md | 5 +++++ crates/tauri/src/ipc/authority.rs | 17 ++++++++--------- 2 files changed, 13 insertions(+), 9 deletions(-) create mode 100644 .changes/fix-referencing-command.md diff --git a/.changes/fix-referencing-command.md b/.changes/fix-referencing-command.md new file mode 100644 index 000000000..087284062 --- /dev/null +++ b/.changes/fix-referencing-command.md @@ -0,0 +1,5 @@ +--- +tauri: patch:bug +--- + +Fix missing `core:` in referenced commands in ACL error message diff --git a/crates/tauri/src/ipc/authority.rs b/crates/tauri/src/ipc/authority.rs index 9097b2286..e304a6d5d 100644 --- a/crates/tauri/src/ipc/authority.rs +++ b/crates/tauri/src/ipc/authority.rs @@ -475,10 +475,10 @@ impl RuntimeAuthority { ) } } else { - let permission_error_detail = if let Some(manifest) = self + let permission_error_detail = if let Some((key, manifest)) = self .acl - .get(key) - .or_else(|| self.acl.get(&format!("core:{key}"))) + .get_key_value(key) + .or_else(|| self.acl.get_key_value(&format!("core:{key}"))) { let mut permissions_referencing_command = Vec::new(); @@ -501,12 +501,12 @@ impl RuntimeAuthority { permissions_referencing_command.sort(); let associated_permissions = permissions_referencing_command - .iter() - .map(|p| { + .into_iter() + .map(|permission| { if key == APP_ACL_KEY { - p.to_string() + permission } else { - format!("{key}:{p}") + format!("{key}:{permission}") } }) .collect::>() @@ -523,8 +523,7 @@ impl RuntimeAuthority { if let Some(resolved_cmds) = command_matches { format!( - "{command_pretty_name} not allowed on origin [{}]. Please create a capability that has this origin on the context field.\n\nFound matches for: {}\n\n{permission_error_detail}", - origin, + "{command_pretty_name} not allowed on origin [{origin}]. Please create a capability that has this origin on the context field.\n\nFound matches for: {}\n\n{permission_error_detail}", resolved_cmds .iter() .map(|resolved| {