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| {