Fix: handle resource names with special characters in admin settings#722
Fix: handle resource names with special characters in admin settings#722Elabyad247 wants to merge 2 commits intomultitheftauto:masterfrom
Conversation
… in admin settings
omar-o22
left a comment
There was a problem hiding this comment.
Tested in admin works correctly, but admin2 the value is not updating, You should restart admin2 or reconnect.
|
It looks like a pre-existing issue in admin2 unrelated to this issue/fix. Would you prefer I dig into it in this PR, or open a separate issue for it so this one stays scoped to #721? |
Umm for me idk you could ask qaisjp about that |
There was a problem hiding this comment.
Pull request overview
Fixes admin/admin2 resource-settings parsing so resource names containing Lua pattern characters don’t break matching, and so leading access markers are only stripped at the start of the key (closing #721).
Changes:
- Anchor the leading access-marker strip (
*/#/@) to the start of the setting key. - Escape
resNamebefore interpolating it into Lua patterns. - Anchor the
resName.prefix removal to the start (and end) of the string for exact matching.
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated 2 comments.
| File | Description |
|---|---|
[admin]/admin2/server/admin_ACL.lua |
Fixes pattern matching in getResourceSettings by anchoring and escaping resName. |
[admin]/admin/server/admin_settings.lua |
Fixes pattern matching in aGetResourceSettings by anchoring and escaping resName. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
|
Once you address the inefficiency that copilot flagged, we're good to go |
|
I moved safeResName and pattern outside the loop to avoid repetitive computation. |
Closes #721
Fix aGetResourceSettings and getResourceSettings pattern matching in admin and admin2
The previous gsub calls had two bugs:
'*','#','@'strip pattern was unanchored, so the character could be stripped from the middle of a name.-) would produce wrong results.Anchor both patterns with '^' and escape special characters in resName.