mirror of
https://github.com/danny-avila/LibreChat.git
synced 2026-04-04 14:57:20 +02:00
fix: allow system role updates when name is unchanged
The updateRoleHandler guard rejected any request where body.name matched a system role, even when the name was not being changed. This blocked editing a system role's description. Compare against the URL param to only reject actual renames to reserved names.
This commit is contained in:
parent
bc5d60f082
commit
88abca5d6d
1 changed files with 5 additions and 1 deletions
|
|
@ -111,7 +111,11 @@ export function createAdminRolesHandlers(deps: AdminRolesDeps) {
|
|||
) {
|
||||
return res.status(400).json({ error: 'name must be a non-empty string' });
|
||||
}
|
||||
if (body.name && SystemRoles[body.name.trim() as keyof typeof SystemRoles]) {
|
||||
if (
|
||||
body.name &&
|
||||
body.name.trim() !== name &&
|
||||
SystemRoles[body.name.trim() as keyof typeof SystemRoles]
|
||||
) {
|
||||
return res.status(409).json({ error: 'Cannot rename to a reserved system role name' });
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue