fix issue where users with larger pve task audit permission could cause a parse error when extracting vmid value from task without a vmid value

This commit is contained in:
2026-03-28 07:25:25 +00:00
parent 6b094690f9
commit 3636878bb7

View File

@@ -156,11 +156,14 @@ func GetClusterResources(auth common.Auth) (map[uint]InstanceCard, map[string]No
if err != nil {
return nil, nil, err
}
// try to get task vmid but continue if it would be an invalid vmid
x, err := strconv.Atoi(task.ID)
task.VMID = uint(x)
// if there was an error converting the task's vmid, skip it
if err != nil {
return nil, nil, err
continue
}
task.VMID = uint(x)
if task.User != auth.Username { // task was not made by user (ie was not a power on/off task)
continue