fix(core): missing core: in referenced commands (#13150)

This commit is contained in:
Tony 2025-04-13 08:03:19 +08:00 committed by GitHub
parent ad3fd3890f
commit 0d39ff6b09
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 13 additions and 9 deletions

View File

@ -0,0 +1,5 @@
---
tauri: patch:bug
---
Fix missing `core:` in referenced commands in ACL error message

View File

@ -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::<Vec<_>>()
@ -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| {